Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    /// <summary>
    /// Display message indicating that target was missed. Choose enemy artillery and perform a counterattack.
    /// </summary>
    private void MissedTarget()
    {
        UI.Output("MISSED TARGET BY " + (2 + RandomInteger(0, 30)) + " MILES!");
        UI.Output("NOW YOU'RE REALLY IN FOR IT !!");

        // Choose enemy and counterattack.
        EnemyArtillery enemyArtillery = ChooseEnemyArtillery();

        if (enemyArtillery == Missiles)
        {
            EnemyCounterattack(enemyArtillery, hitRatePercent: 0);
        }
        else
        {
            int hitRatePercent = EnemyHitRatePercentFromUI();
            if (hitRatePercent < MinEnemyHitRatePercent)
            {
                UI.Output("YOU LIE, BUT YOU'LL PAY...");
                MissionFailed();
            }
            else
            {
                EnemyCounterattack(enemyArtillery, hitRatePercent);
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Choose enemy artillery from UI.
    /// </summary>
    /// <returns>Artillery chosen.</returns>
    private EnemyArtillery ChooseEnemyArtillery()
    {
        EnemyArtillery[] artilleries    = new EnemyArtillery[] { Guns, Missiles, Both };
        string[]         artilleryNames = artilleries.Select(a => a.Name).ToArray();
        int index = UI.Choose("DOES THE ENEMY HAVE", artilleryNames);

        return(artilleries[index]);
    }