Ejemplo n.º 1
0
    public void EnemyTakeDamage(float damageValue, float pushBack)
    {
        if (enemyHP > 0)
        {
            enemyHP -= damageValue;
            space.CreateTextDamage(damageValue, transform.localPosition.x, transform.localPosition.y, true);

            if (enemyHP <= 0)
            {
                int moneyRewardInt = Mathf.CeilToInt(moneyReward);
                prefabPools.CreateExplosion(transform, 0.33f);
                space.ChangeNumberOfEnemies(-10);
                gameManager.board.CreateMatchText(4, moneyRewardInt);
                gameManager.ChangeFunds(moneyRewardInt);
                space.AsteroidDestroyed();
                PushOnStack();
            }
            else
            {
                AdjustHPBar();
            }
        }
    }