GameController.cs 732 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class GameController : MonoBehaviour
  5. {
  6. [System.NonSerialized] public GameObject gameNode;
  7. void Start()
  8. {
  9. gameNode = transform.GetChild(0).gameObject;
  10. if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "GameDemo")
  11. {
  12. gameNode.SetActive(false);
  13. }
  14. }
  15. [System.NonSerialized] public bool crossHairIsOn = true;
  16. void Update()
  17. {
  18. if (Input.GetKeyDown(KeyCode.F1))
  19. {
  20. gameNode.SetActive(!gameNode.activeSelf);
  21. }
  22. if (Input.GetKeyDown(KeyCode.F2))
  23. {
  24. crossHairIsOn = !crossHairIsOn;
  25. }
  26. }
  27. }