You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
741 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [RequireComponent(typeof(BoxCollider))]
  5. public class HidingSpot : MonoBehaviour {
  6. // Use this for initialization
  7. void Start() {
  8. GetComponent<BoxCollider>().isTrigger = true;
  9. }
  10. // Update is called once per frame
  11. void Update() {
  12. }
  13. void OnTriggerEnter(Collider other) {
  14. if (other.gameObject.CompareTag("Player")) {
  15. Searchlight.playerHidden = true;
  16. Debug.Log("player here");
  17. }
  18. }
  19. void OnTriggerExit(Collider other) {
  20. if (other.gameObject.CompareTag("Player")) {
  21. Searchlight.playerHidden = false;
  22. Debug.Log("player exit");
  23. }
  24. }
  25. }