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.

29 lines
641 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. }
  17. void OnTriggerExit(Collider other) {
  18. if (other.gameObject.CompareTag("Player"))
  19. Searchlight.playerHidden = false;
  20. }
  21. }