Esempio n. 1
0
    public void KillAgent()
    {
        GameConstants.Instance.PlayerObject.GetComponent <PlayerHandler>().IncreaseKilledSpaceShipsCount(1);

        int randomExplosion = Random.Range(0, 3);

        if (randomExplosion == 0)
        {
            AudioSystem.Instance.PlaySound("Explosion", 0.08f);
        }
        else if (randomExplosion == 1)
        {
            AudioSystem.Instance.PlaySound("Explosion01", 0.08f);
        }
        else
        {
            AudioSystem.Instance.PlaySound("Explosion02", 0.08f);
        }

        mBoidController.ResetBoid();
        mBoidController.RemoveBoidFromManager();

        for (int i = 0; i < 5; i++)
        {
            GameObject newEnergyBall    = PoolSystem.Instance.GetObjectFromPool(mEnergyBall, argShouldExpandPool: true, argShouldCreateNonExistingPool: true);
            EnergyBall energyBallScript = newEnergyBall.GetComponent <EnergyBall>();
            energyBallScript.SetupEnergyBall(Random.Range(3, 7), transform.position);
            energyBallScript.ActivateEnergyBall();
        }

        gameObject.SetActive(false);
    }