Beyond_Beyaan.Fleet.SubtractTransport C# (CSharp) Method

SubtractTransport() public method

public SubtractTransport ( Race race, int amount ) : void
race Beyond_Beyaan.Data_Modules.Race
amount int
return void
        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);
            }
        }