コード例 #1
0
        // Returns the cost (or income) to buy the ship. If cost is negative, than
        // the player will receive money upon changing the ship. the cost of the
        // ship is decreased for each item in the cargo
        public int CostToBuy(Ship shipToBuy)
        {
            int total = shipToBuy.Price;

            foreach (Good cargo in Game.Instance.Player.Ship.Cargo)
            {
                total -= marketplace.GetPrice(cargo);
            }

            //TODO: implement gadgets
            total -= Game.Instance.Player.Ship.Price;

            return(total);
        }