// Use this for initialization void Start() { Random.seed = System.DateTime.Now.Second; being_chased = false; villain = GameObject.Find("Villain").GetComponent <VillainAI> (); villain.whileChasing += () => { if (!being_chased) { being_chased = true; heavy_breathing.Play(); } }; villain.whilePatrolling += () => { if (being_chased) { being_chased = false; heavy_breathing.Stop(); } }; GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ().onGameRestart += () => { if (heavy_breathing.isPlaying) { heavy_breathing.Stop(); } }; //invoke play kidScream }
void Awake() { GameObject enemy = GameObject.FindGameObjectWithTag("Enemy"); GameObject playerObj = GameObject.FindGameObjectWithTag("Player"); villain = enemy.transform; villainAI = enemy.GetComponent <VillainAI>(); player = playerObj.transform; sight = playerObj.GetComponent <PlayerSight>(); villainNav = villain.gameObject.GetComponent <NavMeshAgent>(); }
void Awake () { GameObject villainObj = GameObject.FindGameObjectWithTag("Enemy"); villain = villainObj.transform; villainAI = villainObj.GetComponent<VillainAI>(); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>(); initialPosition = transform.position; initialRotation = transform.rotation; villainAI.whileChasing += ResetTimer; gameController.onGameRestart += Start; }
void Awake() { GameObject villainObj = GameObject.FindGameObjectWithTag("Enemy"); villain = villainObj.transform; villainAI = villainObj.GetComponent <VillainAI>(); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); initialPosition = transform.position; initialRotation = transform.rotation; villainAI.whileChasing += ResetTimer; gameController.onGameRestart += Start; }
// Use this for initialization void Start () { Random.seed = System.DateTime.Now.Second; being_chased = false; villain = GameObject.Find ("Villain").GetComponent<VillainAI> (); villain.whileChasing += () => { if (!being_chased) { being_chased = true; heavy_breathing.Play (); } }; villain.whilePatrolling += () => { if (being_chased) { being_chased = false; heavy_breathing.Stop (); } }; GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ().onGameRestart += () => { if (heavy_breathing.isPlaying) { heavy_breathing.Stop (); } }; //invoke play kidScream }