Example #1
0
 private void CheckBattleProgress()
 {
     if (BlueforShips.All(ship => !ship.IsAlive))
     {
         FailMission();
     }
     if (RedforShips.All(ship => !ship.IsAlive))
     {
         SucceedMission();
     }
 }
Example #2
0
    private void CleanUp()
    {
        var deadPlayerShips = BlueforShips.Where(ship => !ship.IsAlive).ToList();

        foreach (var ship in deadPlayerShips)
        {
            var playerShipControl = _playerShipControls.Single(control => control.Ship == ship);
            _playerShipControls.Remove(playerShipControl);
            Destroy(playerShipControl.gameObject);

            _ships.Remove(ship);
            Destroy(ship.gameObject);
        }

        var deadEnemyShips = RedforShips.Where(ship => !ship.IsAlive).ToList();

        foreach (var ship in deadEnemyShips)
        {
            _ships.Remove(ship);
            Destroy(ship.gameObject);
        }
    }