DemoInputConrtoller.cs 874 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine;
  2. namespace MaterializationFX.Scripts.Utils
  3. {
  4. internal sealed class DemoInputConrtoller : MonoBehaviour
  5. {
  6. private const string SpaceButton = "space";
  7. private const string LightButton = "f";
  8. private DemoPrefabController _demoPrefabController;
  9. public Light Light;
  10. public void EnableLigh()
  11. {
  12. Light.enabled = true;
  13. }
  14. public void DisableLight()
  15. {
  16. Light.enabled = false;
  17. }
  18. private void Start()
  19. {
  20. _demoPrefabController = GetComponent<DemoPrefabController>();
  21. }
  22. private void Update()
  23. {
  24. if (Input.GetKeyDown(SpaceButton))
  25. _demoPrefabController.Next();
  26. if (Input.GetKeyDown(LightButton))
  27. Light.enabled = !Light.enabled;
  28. }
  29. }
  30. }