Exemple #1
0
    public RestaurantBook SimulateMonth(int numbOfGuest, int days)
    {
        float numbFOOD = numbOfGuest/days;
        float numbDRINK = numbOfGuest/days;
        RestaurantBook newMonth = new RestaurantBook (Calendar.GetDate(), days , MasterReference.restaurantLevel, MasterReference.barLevel
                                                      , Staff.staffFoodAndBeverages.Count, foodPrice, liquorPrice, condition);
        //reset daily numbers at start of day. Need to save them somewhere later.
        dailyFoodSales = 0;
        dailyBeverageSales = 0;
        dailyTotalProdNeeded = 0;
        lostCustomers = 0;

        float staffProduction = CalculateProductivity();
        float foodPriceRatio = medianFoodPrice [MasterReference.restaurantLevel - 1] / foodPrice;
        float beveragePriceRatio = medianBeveragePrice [MasterReference.barLevel - 1] / liquorPrice;
        //Simulate one day at the time.
        for (int k = 0; k < days; k++)
        {

            float requiredProduction = (numbFOOD*prodRequiredFood+numbDRINK*prodRequiredBeverage);  //production required for the day.

            //condition checks.
            condition += (staffProduction-requiredProduction)/100f;
            if(condition > 100f)
                condition = 100f;//can't have better than 100 condition.
            if(condition < 0)
                condition = 0f;//can't have worst than 0 condition.
            //.......................
            float rngRatioFood = condition * foodPriceRatio;
            float rngRatioBeverage = condition * beveragePriceRatio;
            for (int i = 0; i < numbFOOD; i++)
            {
                if (RandomGenerator (rngRatioFood))
                {
                    dailyFoodSales += foodPrice;
                }
                else{lostCustomers++;}
            }
            //beverage purchases.
            for (int j = 0; j < numbDRINK; j++) {
                if (RandomGenerator (rngRatioBeverage))
                {
                    dailyBeverageSales += liquorPrice;
                }
                else{lostCustomers++;}
            }

        }
        newMonth.staffCost = StaffCost ();
        newMonth.lostCustomers = lostCustomers;
        newMonth.totalFoodSales = dailyFoodSales;
        newMonth.totalBeverageSales = dailyBeverageSales;
        newMonth.conditionEnd = condition;
        newMonth.productivityNeeded = dailyTotalProdNeeded;
        return newMonth;
    }
Exemple #2
0
    //Runs (simulates) the reception desk for one month.
    public IEnumerator RunWeeklySimulation()
    {
        float staffCostMonthlyDP = 0;
        float staffCostMonthlyHS = 0;
        float staffCostMonthlyFB = 0;
        float staffCostMonthlyFD = 0;
        float staffCostMonthlyCF = 0;
        float staffCostMonthlyOT = 0;

        isSimulating = true;
        MasterReference.accountsPayable += bankingTab.GetLoanRepayments();
        MasterReference.accountsPayable += emsTab.GetMonthlyEMSCosts();
        MasterReference.accountsReceivable = 0f;

        //Monthly Report Creator.
        newMonthlyReport.numbDepartmentHead = Staff.staffDepartmentHead.Count;
        newMonthlyReport.numbHotelServicesStaff = Staff.staffHotelServices.Count;
        newMonthlyReport.numbFoodAndBeverageStaff = Staff.staffFoodAndBeverages.Count;
        newMonthlyReport.numbFrontDeskStaff = Staff.staffFrontDesk.Count;
        newMonthlyReport.numbConferenceStaff = Staff.staffConference.Count;
        newMonthlyReport.numbOtherStaff = Staff.staffOthers.Count;
        //-------------------------------------------//
        for (int weeks = 0; weeks < Calendar.GetNumberOfWeeksInMonth(); weeks++)
        {

            //Try and generate a random event each week.
            randomEvent.InitiateRandomEvent();
            //runs the stafftraining function to increase or decrease staff training.
            staffMenu.TrainStaff();
            //once a week degrade our special rooms.
            refurbishmentTab.DegradeSpecialRooms();
            //-------------------------------------------run day by day simulation---------------------------------------------------------//

            yield return new WaitForSeconds(debugDayDelay);
            //For each of the weekdays (Mon-Thurs inclusive) try to book rooms based on popularity vs cost
            WeekDays dayOfWeek;
            for (dayOfWeek = WeekDays.Monday; dayOfWeek <= WeekDays.Sunday; dayOfWeek++)
            {
                //set the date.
                Calendar.addDay();
                Days++;
                //Ticks the billboard duration by one.
                assetSwapper.TickDown();
                //Determine how many special groups will book.
                specialBookings specialBooked = SpecialBookingRun();
                //Determine how many rooms we will try to book:
                int roomsToBook = (int)((calendarController.seasonalTrends[Calendar.GetDayOfTheYear()]) *
                                        (MasterReference.ReturnRegularBookingPop() / 100f));

                //check if enought ppl show up to trigger overbooking.
                if((roomsToBook-specialBooked.numberOfRooms)/(BedroomBehaviour.allBedrooms.Count-specialBooked.numberOfRooms) > 0.9 && revenueManagementTab.GetOverbooked())
                {

                    roomsToBook += (roomsToBook/revenueManagementTab.GetOverbooking());

                    int overbookedCustomer = ((roomsToBook+specialBooked.numberOfRooms) - BedroomBehaviour.allBedrooms.Count);
                    if(overbookedCustomer > 0)
                    {
                        for(int i = 0; i < overbookedCustomer; i++)
                        {
                            feedbackController.TryGenFeedBack("OverBooked",70f);//70% chance an overbooked customer will complain.

                            MasterReference.accountsPayable += 300f;
                            MasterReference.hotelExposure--;
                        }
                    }
                }

                //Try to book specialgroups Rooms.---------------
                BedroomBehaviour.GetNumberOfRoomsAvailable();
                if(BedroomBehaviour.roomsAvailable > specialBooked.numberOfRooms && specialBooked.numberOfRooms != 0)
                {
                    //check for price ratio here.
                    if(CheckGroupCost(specialBooked))
                    {
                        //Debug.LogError("Special Group Booked for "+ specialBooked.numberOfDays + " Days for "+ specialBooked.numberOfRooms + "rooms for a "+ specialBooked.type);
                        for(int i = 0; i < specialBooked.numberOfRooms; i++)
                        BookRoomSpecial(dayOfWeek, specialBooked);
                    }
                    else
                    {
                        feedbackController.TryGenFeedBack("Expensive",30f);//30% chance customoer will complain for overpriced.
                    }
                }
                else if(specialBooked.numberOfRooms != 0)
                {
                    //need to provide feedback to the player that a group tryed to book rooms but hotel didn't have capacity.
                    feedbackController.TryGenFeedBack("Full",10f);//10% chance customer will complain due to full capacity.
                }

                //-----------------------------------------------
                float occupancyDiscount =  controller.transform.FindChild ("RevenueManagerCTR").gameObject.GetComponent<RevenueManagement>().discountOnOccupancy();

                //Try to book that many rooms:
                for (int j = 0; j < roomsToBook; j++)
                {
                    BedroomBehaviour.GetNumberOfRoomsAvailable ();
                    if (BedroomBehaviour.roomsAvailable > 0)
                    {
                        BookRoom (dayOfWeek, occupancyDiscount);
                    }
                    else
                    {
                        Debug.Log("no rooms");
                        feedbackController.TryGenFeedBack("Full",10f);//10% chance customer will complain due to full capacity.
                    }
                }
                //set the price for current occupancy
                BedroomBehaviour.occupancyDiscount = occupancyDiscount/100f;
                //Step the day counter for all rooms
                BedroomBehaviour.StepDay (dayOfWeek);
                float ProdReq = BedroomBehaviour.ProdRequired;
                float StaffProduction = staffMenu.returnActualProduction(ProdReq);
                BedroomBehaviour.CleanRooms (StaffProduction);
                //print (ProdReq + ", " +StaffProduction);

                float[] dailyCost = staffMenu.ReturnCostPerDay();
                staffCostMonthlyDP += dailyCost[0];
                staffCostMonthlyHS += dailyCost[1];
                staffCostMonthlyFB += dailyCost[2];
                staffCostMonthlyFD += dailyCost[3];
                staffCostMonthlyCF += dailyCost[4];
                staffCostMonthlyOT += dailyCost[5];

                //adds all 6 staff list's cost daily.
                MasterReference.accountsPayable += (dailyCost[0]+dailyCost[1]+dailyCost[2]
                                                    +dailyCost[3]+dailyCost[4]+dailyCost[5]);

                toolbar.UpdateCredits();
                yield return new WaitForSeconds (debugDayDelay);
            }

        }
        //-----------------------------------SIMULATE THE RESTAURANT-----------------------------------------------//
        //create a new restaurant book with simulated data. 1 month at the time.
        newRestaurantBook =
            GameObject.FindGameObjectWithTag("Restaurant").GetComponent<Restaurant>().SimulateMonth (newMonthlyReport.totalBookings()
                                                                                                    , 7*Calendar.GetNumberOfWeeksInMonth());
        restaurantBooks.Add (newRestaurantBook);//creates a new log for the restaurant numbers. stored inside a list.

        //--------------------------------ASSIGN VALUE OF NEW BALANCE SHEET----------------------------------------//
        BalanceSheet newBalanceSheet =
            new BalanceSheet(Calendar.GetDate(), MasterReference.cashAtBank, MasterReference.accountsReceivable,
                             MasterReference.inventories, MasterReference.totalCurrentAssets(), MasterReference.propretyAndEquipment,
                             MasterReference.totalAssets(), MasterReference.accountsPayable, MasterReference.carbonOffsetReceipts,
                             MasterReference.incomeTaxPayable, MasterReference.dividendOwed, MasterReference.currentMaturityofLongtermDebt,
                             MasterReference.totalCurrentLiabilities(), MasterReference.longTermDebt, MasterReference.shareCapital,
                             MasterReference.retainedEarnings, MasterReference.ownersEquity(), MasterReference.totalLiabilitiesAndOwnersEquity);
        //add date reference for nicer serialization
        Date currentDate = Calendar.GetDate();
        newBalanceSheet.dayOfTheMonth = currentDate.dayOfTheMonth;
        newBalanceSheet.month = currentDate.month;
        newBalanceSheet.year = currentDate.year;
        newBalanceSheet.day = currentDate.day;
        newBalanceSheet.numberOfWeeks = Calendar.GetNumberOfWeeksInMonth(balanceSheets.Count%12);
        balanceSheets.Add(newBalanceSheet);
        //-------------------------------ADD DATA TO MONTHLY REPORT------------------------------------------------//
        newMonthlyReport.restaurantTake = (newRestaurantBook.totalBeverageSales + newRestaurantBook.totalFoodSales);

        refurbishmentTab.refreshTabs ();
        newMonthlyReport.numbRoomLvl1 = MasterReference.standardRooms;
        newMonthlyReport.numbRoomLvl2 = MasterReference.doubleRooms;
        newMonthlyReport.numbRoomLvl3 = MasterReference.deluxeRooms;
        newMonthlyReport.numbRoomLvl4 = MasterReference.suites;
        newMonthlyReport.numbRoomLvl5 = MasterReference.masterSuites;

        newMonthlyReport.expenseDepartmentHeadStaff = staffCostMonthlyDP;
        newMonthlyReport.expenseHotelServicesStaff = staffCostMonthlyHS;
        newMonthlyReport.expenseFoodAndBeverageStaff = staffCostMonthlyFB;
        newMonthlyReport.expenseFrontDeskStaff = staffCostMonthlyFD;
        newMonthlyReport.expenseConferenceStaff = staffCostMonthlyCF;
        newMonthlyReport.expenseOtherStaff = staffCostMonthlyOT;
        //-----------------------------------ADD AMOUNTS FOR END OF MONTH DATA-------------------------------------//
        MasterReference.accountsReceivable += (newRestaurantBook.totalBeverageSales + newRestaurantBook.totalFoodSales);
        MasterReference.accountsPayable += MasterReference.guessComfortMonthlySpending + MasterReference.upgradeCost;//cost of guest comfort amunities.
        //-----------------------------------ADD Account Payable and Receivable at END OF MONTH--------------------//
        MasterReference.cashAtBank -= MasterReference.accountsPayable;
        MasterReference.cashAtBank += MasterReference.accountsReceivable;

        newBalanceSheet.cashAtBank = MasterReference.cashAtBank;

        //---------------------------------------------------------------------------------------------------------//
        bankingTab.GetComponent<BankingReport>().EndMonth();//tick all loan duration down once.
        MasterReference.currentMonthInt++;
        isSimulating = false;
        MasterReference.accountsPayable = 0f;
        adController.Tick();//Ends the month for all ad campaigns and decay/improves hotel exposures.
        //-------------------------------------END OF SIMULATION LOOP---------------------------------------------//

        //------------------------------------------AUTO SAVE-----------------------------------------------------//
        dataProcessor.SaveGame();
        //-------------------------------------RESET SOME DATA----------------------------------------------------//
        MasterReference.upgradeCost = 0f;
    }
Exemple #3
0
 public void Add(RestaurantBook restaurantBook)
 {
     restaurantBooklist.Add(restaurantBook);
 }