コード例 #1
0
        /// <summary>
        /// Closes a single outlet that this company owns.
        /// </summary>
        public void CloseOutlet(Outlet outlet)
        {
            //Incur a cost per seat, depending on the type.
            int cps = -1;

            switch (Type)
            {
            case CompanyType.FastFood: cps = Settings.Get.FastFoodClosingCostPerSeat; break;

            case CompanyType.Family: cps = Settings.Get.FamilyClosingCostPerSeat; break;

            case CompanyType.NamedChef: cps = Settings.Get.NamedChefClosingCostPerSeat; break;

            default: throw new Exception("Invalid company type to close.");
            }

            //Incur the cost.
            Balance -= cps * outlet.Capacity;

            //Now, close the actual outlet.
            outlets.Remove(outlet);
        }
コード例 #2
0
 //Uses AQA patented dark magic technology to calculate distances between outlets.
 private double GetDistanceBetweenOutlets(Outlet outlet1, Outlet outlet2)
 {
     return(Math.Sqrt((Math.Pow(outlet1.Position.x - outlet2.Position.x, 2)) + (Math.Pow(outlet1.Position.y - outlet1.Position.y, 2))));
 }
コード例 #3
0
 /// <summary>
 /// Expands this outlet from it's current capacity.
 /// </summary>
 public void ExpandOutlet(Outlet outlet, int amtSeats)
 {
     OutletCapacity += amtSeats;
     DailyCost      += amtSeats * 0.5;
 }