DetailsLevel.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Status
  5. {
  6. /// <summary>
  7. /// DetailsLevel manages and changes the current details level
  8. /// </summary>
  9. public class DetailsLevel : MonoBehaviour
  10. {
  11. /// <summary>
  12. /// Currently active details level
  13. /// State == 0 LOD Group handles model
  14. /// State == 1 blocks only
  15. /// State == 2 models without color
  16. /// State == 3 models with color and full detail
  17. /// </summary>
  18. public static int State = 0;
  19. /// <summary>
  20. /// Maximum number of states
  21. /// </summary>
  22. private readonly static int NumberOfMStates = 4;
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. // Change current state via button press
  27. if (Input.GetButtonDown("Change"))
  28. {
  29. CycleStates(1);
  30. }
  31. }
  32. public void CycleStates(short direction)
  33. {
  34. State = (State + (int)Mathf.Sign(direction)) % (NumberOfMStates);
  35. }
  36. }
  37. }