예제 #1
0
파일: Karl.cs 프로젝트: pasonjakub/Vikings
 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;
     }
 }
예제 #2
0
파일: Karl.cs 프로젝트: pasonjakub/Vikings
        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!");
            }
        }