ProfilerOverlay.cs 920 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace BansheeEngine
  6. {
  7. // Note: Must be the same as C++ enum ProfilerOverlayType
  8. public enum ProfilerOverlayType
  9. {
  10. CPUSamples,
  11. GPUSamples
  12. };
  13. public class ProfilerOverlay : Component
  14. {
  15. private ProfilerOverlayInternal impl;
  16. public bool Paused { get; set; }
  17. public void SetType(ProfilerOverlayType type)
  18. {
  19. impl.SetType(type);
  20. }
  21. private void OnReset()
  22. {
  23. if (impl != null)
  24. impl.Destroy();
  25. Camera cam = SceneObject.GetComponent<Camera>();
  26. impl = new ProfilerOverlayInternal(cam);
  27. }
  28. private void Update()
  29. {
  30. if(!Paused)
  31. impl.Update();
  32. }
  33. private void OnDestroy()
  34. {
  35. impl.Destroy();
  36. }
  37. }
  38. }