예제 #1
0
    void Die()
    {
        objectPooler.DeactivateSpriteInPool(this.gameObject);

        /**
         *  This is to help with performance. There's only so many multipliers we want to be spawning at a single time (especially if a huge horde of drones die at once), else the frame rate drops considerably. We just assume any extra multipliers that need to spawn will be automatically collected by the player.
         */
        if (objectPooler.AllObjectsActiveForPool("Multiplier"))
        {
            Multiplier.TriggerCollect(numMultipliersOnDeath);
        }
        else
        {
            for (int i = 0; i < numMultipliersOnDeath; i++)
            {
                multiplierManager.SpawnSpriteAround(this.transform.position, multiplierSpawnRadius);
            }
        }

        OnDroneDeath?.Invoke(this);
    }
예제 #2
0
 /// <summary>
 /// Fires when drone dies (collides with anything tagged 'deadzone')
 /// </summary>
 public void EventDroneDeath()
 {
     OnDroneDeath?.Invoke();
 }