コード例 #1
0
        public void SubtractTransport(Race race, int amount)
        {
            TransportShip transportShipToRemove = null;

            foreach (TransportShip transport in _transportShips)
            {
                if (transport.raceOnShip == race)
                {
                    transport.amount -= amount;
                    if (transport.amount <= 0)
                    {
                        transportShipToRemove = transport;
                    }
                }
            }
            if (transportShipToRemove != null)
            {
                TransportShips.Remove(transportShipToRemove);
            }
        }
コード例 #2
0
        public void AddTransport(Race race, int amount)
        {
            bool added = false;

            foreach (TransportShip transport in _transportShips)
            {
                if (transport.raceOnShip == race)
                {
                    transport.amount += amount;
                    added             = true;
                    break;
                }
            }
            if (!added)
            {
                TransportShip transport = new TransportShip();
                transport.raceOnShip = race;
                transport.amount     = amount;
                _transportShips.Add(transport);
            }
            _maxSpeed = 1;
        }
コード例 #3
0
ファイル: Fleet.cs プロジェクト: rjaxon/beyond-beyaan
 public void AddTransport(Race race, int amount)
 {
     bool added = false;
     foreach (TransportShip transport in _transportShips)
     {
         if (transport.raceOnShip == race)
         {
             transport.amount += amount;
             added = true;
             break;
         }
     }
     if (!added)
     {
         TransportShip transport = new TransportShip();
         transport.raceOnShip = race;
         transport.amount = amount;
         _transportShips.Add(transport);
     }
     _maxSpeed = 1;
 }