Exemple #1
0
 public void VisitStorage(Shipyard currentShipyard, Storage storage, int WoodenPlanks, double Ropes)
 {
     if (storage.WoodenPlanks >= WoodenPlanks && storage.Ropes >= Ropes)
     {
         currentShipyard.WoodenPlanks += WoodenPlanks;
         storage.WoodenPlanks         -= WoodenPlanks;
         currentShipyard.Ropes        += Ropes;
         storage.Ropes -= Ropes;
     }
 }
Exemple #2
0
        public string BuildLongship(Shipyard currentShipyard, Harbour harbour)
        {
            int    WoodenPlanks = 200;
            double Ropes        = 120;

            if (currentShipyard.WoodenPlanks >= WoodenPlanks && currentShipyard.Ropes >= Ropes)
            {
                harbour.Boats.Add(new Longship());
                currentShipyard.WoodenPlanks -= WoodenPlanks;
                currentShipyard.Ropes        -= Ropes;
                return("Successfully built longship");
            }
            else
            {
                return("Not enough materials!");
            }
        }