예제 #1
0
    /// <summary>
    /// Check the given row/column
    /// </summary>
    /// <param name="row">The row to attack</param>
    /// <param name="col">The col to attack</param>
    /// <returns>The result of the check</returns>
    internal AttackResult Check(int row, int col)
    {
        AttackResult result = default(AttackResult);

        if (RadarLimit == 0)
        {
            result = new AttackResult(ResultOfAttack.RadarUsed, "have already used all of your radar charge!", row, col);
            return(result);
        }

        else if (Radar == true)
        {
            result = new AttackResult(ResultOfAttack.RadarUsed, "have already used your radar for this turn!", row, col);
            return(result);
        }

        result = EnemyGrid.CheckTile(row, col);

        switch (result.Value)
        {
        case ResultOfAttack.Destroyed:
        case ResultOfAttack.Hit:
            _hits += 1;
            break;

        case ResultOfAttack.Miss:
            _misses += 1;
            break;
        }

        return(result);
    }