Ejemplo n.º 1
0
    public void EnemyDefeated(bool microEnemy)
    {
        if (!microEnemy)
        {
            ChangeNumberOfEnemies(-1);

            //set threat to new point
            if (topPanel.currentThreat < 99.0f)
            {
                enemiesDefeated++;
                topPanel.IncreaseThreat(99.5f / enemiesInLevel[whichLevel]);
            }
            else if (topPanel.currentThreat >= 100.0f)
            {
                enemiesDefeated++;
                topPanel.IncreaseThreat(10.0f);
            }
            else
            {
                topPanel.IncreaseThreat(100.0f - topPanel.currentThreat);
                gameManager.EndLevel(true);
            }

            //start level break if appropriate
            if (enemiesDefeated % 5 == 0)
            {
                PlayerStats.playerStats.levelThreat[whichLevel] = topPanel.currentThreat;
                PlayerStats.playerStats.Save();
                if (Mathf.CeilToInt(topPanel.currentThreat) != 100.0f)
                {
                    asteroidsDestroyed = 0;
                    gameManager.ship.ResetDamageTaken();
                    LevelBreak(5);
                }
            }
        }
    }