1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SpawnWatcher : MonoBehaviour
- {
- public bool spawnIsFree;
- public List<string> consideredTags;
- // Start is called before the first frame update
- void Start()
- {
- this.spawnIsFree = true;
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- private void OnTriggerEnter(Collider other)
- {
- if (this.consideredTags.Contains(other.tag))
- {
- //Debug.Log("Spawn isn´t free because " + other.tag);
- this.spawnIsFree = false;
- }
- }
- private void OnTriggerExit(Collider other)
- {
- if (this.consideredTags.Contains(other.tag))
- {
- //Debug.Log("Spawn is free again because " + other.tag);
- this.spawnIsFree = true;
- }
- }
- }
|