MyGui.cs 817 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MyGui : MonoBehaviour
  5. {
  6. public SteeringLineRobot robot;
  7. public GameObject shadowbox;
  8. private void OnGUI()
  9. {
  10. if (GUI.Button(new Rect(10, 20, 150, 20), "Toggle Holding Brake"))
  11. {
  12. if (robot.handBrake == true)
  13. {
  14. robot.handBrake = false;
  15. }
  16. else
  17. {
  18. robot.handBrake = true;
  19. }
  20. }
  21. if (GUI.Button(new Rect(10, 50, 150, 20), "Toggle Shade"))
  22. {
  23. if (shadowbox.activeSelf == false)
  24. {
  25. shadowbox.SetActive(true);
  26. }
  27. else
  28. {
  29. shadowbox.SetActive(false);
  30. }
  31. }
  32. }
  33. }