コード例 #1
0
 // Minion calls this function, when it is destroyed
 public void MinionDied(Minion minion, BigIntWithUnit currencyGivenOnDeath, float delay)
 {
     if (WaveManager.SafeRemove(minion))
     {
         IncreaseCurrency(currencyGivenOnDeath, minion.transform.position);
         if (_audioManager)
         {
             _audioManager.PlayMinionDeathSound();
         }
         if (minion.tag == "Boss")
         {
             if (minion.Data.HasMageLoot() && !Data.IsMageListFull() && WaveManager.AliveMinionCount == 0)
             {
                 // Add Mage after the "death" animation of boss finishes.
                 StartCoroutine(AddMage(minion, delay));
             }
             else
             {
                 Destroy(minion.gameObject, delay);
                 StartCoroutine(SendWave(minion, delay));
             }
         }
     }
     if (!WaveManager.Data.IsBossWave)
     {
         // Destroy the game object and also send a new wave after the "death" animation of boss finishes.
         Destroy(minion.gameObject, delay);
         if (WaveManager.AliveMinionCount == 0)
         {
             StartCoroutine(SendWave(minion, delay));
         }
     }
 }