DemoManager_XPTitles.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. 
  2. // =================================
  3. // Namespaces.
  4. // =================================
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. //using System.Collections;
  8. // =================================
  9. // Define namespace.
  10. // =================================
  11. namespace MirzaBeig
  12. {
  13. namespace ParticleSystems
  14. {
  15. namespace Demos
  16. {
  17. // =================================
  18. // Classes.
  19. // =================================
  20. //[ExecuteInEditMode]
  21. [System.Serializable]
  22. public class DemoManager_XPTitles : MonoBehaviour
  23. {
  24. // =================================
  25. // Nested classes and structures.
  26. // =================================
  27. // ...
  28. // =================================
  29. // Variables.
  30. // =================================
  31. // ...
  32. LoopingParticleSystemsManager list;
  33. public Text particleCountText;
  34. public Text currentParticleSystemText;
  35. Rotator cameraRotator;
  36. // =================================
  37. // Functions.
  38. // =================================
  39. // ...
  40. void Awake()
  41. {
  42. (list = GetComponent<LoopingParticleSystemsManager>()).Init();
  43. }
  44. // ...
  45. void Start()
  46. {
  47. cameraRotator = Camera.main.GetComponentInParent<Rotator>();
  48. updateCurrentParticleSystemNameText();
  49. }
  50. // ...
  51. public void ToggleRotation()
  52. {
  53. cameraRotator.enabled = (!cameraRotator.enabled);
  54. }
  55. public void ResetRotation()
  56. {
  57. cameraRotator.transform.eulerAngles = Vector3.zero;
  58. }
  59. // ...
  60. void Update()
  61. {
  62. // Scroll through systems.
  63. if (Input.GetAxis("Mouse ScrollWheel") < 0)
  64. {
  65. Next();
  66. }
  67. else if (Input.GetAxis("Mouse ScrollWheel") > 0)
  68. {
  69. previous();
  70. }
  71. //// Activate/deactive camera rotation.
  72. //if (Input.GetKeyDown(KeyCode.Space))
  73. //{
  74. // ToggleRotation();
  75. //}
  76. //// Reset camera rotator transform rotation.
  77. //if (Input.GetKeyDown(KeyCode.R))
  78. //{
  79. // ResetRotation();
  80. //}
  81. }
  82. // ...
  83. void LateUpdate()
  84. {
  85. if (particleCountText)
  86. {
  87. // Update particle count display.
  88. particleCountText.text = "PARTICLE COUNT: ";
  89. particleCountText.text += list.GetParticleCount().ToString();
  90. }
  91. }
  92. // ...
  93. public void Next()
  94. {
  95. list.Next();
  96. updateCurrentParticleSystemNameText();
  97. }
  98. public void previous()
  99. {
  100. list.Previous();
  101. updateCurrentParticleSystemNameText();
  102. }
  103. // ...
  104. void updateCurrentParticleSystemNameText()
  105. {
  106. if (currentParticleSystemText)
  107. {
  108. currentParticleSystemText.text = list.GetCurrentPrefabName(true);
  109. }
  110. }
  111. // =================================
  112. // End functions.
  113. // =================================
  114. }
  115. // =================================
  116. // End namespace.
  117. // =================================
  118. }
  119. }
  120. }
  121. // =================================
  122. // --END-- //
  123. // =================================