private Tower_Script tower_script; //タワーの取得型 // Use this for initialization void Start() { tower_script = GameObject.Find("Tower").GetComponent <Tower_Script>(); akikan_appearance = GameObject.Find("akikan_appearance").GetComponent <EnemyAppearance>(); bottle_appearance = GameObject.Find("bottle_appearance").GetComponent <EnemyAppearance>(); battery_appearance = GameObject.Find("battery_appearance").GetComponent <EnemyAppearance>(); //start_frequency = frequency; wave = 1; }
/// <summary> /// Appearance completed event /// Called when an appearance is cleared /// </summary> /// <param name="enemyAppearance">The enemy appearance that has been cleared</param> private void EnemyAppearanceCompletedEvent(EnemyAppearance enemyAppearance) { _clearedAppearances++; // Unsubscribe for convinience enemyAppearance.AppearanceCompletedEvent -= EnemyAppearanceCompletedEvent; enemyAppearance.SpawnedEvent -= EnemyAppearanceOnSpawnedEventHandler; // We check if this is the last appearance if (_clearedAppearances == Appearances.Length) { // If it is, we do some cleanup GlobalEventSystem<EnemyDiedEvent>.EventHappened -= SpawnedEnemyOnDiedEvent; // And raise our WaveClearedEvent if (WaveClearedEvent != null) { WaveClearedEvent(this); } } }
/// <summary> /// An appearance enemy spawned event handler /// We spawn our actual enemy here /// </summary> /// <param name="enemy">A enemy to spawn</param> /// <param name="appearance">Appearance that wants to spawn an enemy</param> private void EnemyAppearanceOnSpawnedEventHandler(Enemy enemy, EnemyAppearance appearance) { var spawnedEnemy = Instantiate(enemy); _enemyAppearanceReveseLookup[spawnedEnemy] = appearance; }