Vector3 prevPlayer; // Previous Player Position // Use this for initialization private void Awake() { _time = NextTimeSpawn() + 6f; // Time Till Next Enemies are Spawned _radarNoticeSpan = -1; // Want radar sound to play on 1st run // Dictionary to Hold Radar info of that Enemy type _RadarAnimator = new Dictionary <string, RadarHandle>(); _RadarAnimator["Laser"] = new RadarHandle(Radar.transform.Find("Laser").gameObject.GetComponent <Animator>()); _RadarAnimator["Missle"] = new RadarHandle(Radar.transform.Find("Missle").gameObject.GetComponent <Animator>()); _RadarAnimator["Jet"] = new RadarHandle(Radar.transform.Find("Jet").gameObject.GetComponent <Animator>()); // Radar Audio Source _radarAudio = Radar.GetComponent <AudioSource>(); // Not enouph spawn locations that SpawnMax requests if (SpawnMax > Spawns.Length) { throw new Exception("ERROR!: Not enouph spawn locations that SpawnMax requests"); } }
// Activates Radar for Specific Enemy // radar: obj of RadarHandle for the specific Enemy // timeout: how long the notice should last IEnumerator RadarSignal(RadarHandle radar, float timeout) { // Activates Radar for Specific Enemy // Start Radar Anim radar._occur++; // increment the number of sets of the same type of enemy radar._Animator.SetBool("Active", true); // Wait Desired Radar Signal time yield return(new WaitForSeconds(timeout)); radar._occur--; // decrement the number of sets of the same type of enemy // Turn off radar: if there is no more of that enemy existing of the game if (radar._occur < 0) { radar._occur = 0; } if (radar._occur == 0) { radar._Animator.SetBool("Active", false); } }