//Placeholder until we get something proper in private void GenerateRandomResult() { List <SlotMachineDrink> RandomDrinks = new List <SlotMachineDrink>(); //just add 3 random drinks until we get something better RandomDrinks.Add(DrinksList[Random.Range(0, DrinksList.Count)]); RandomDrinks.Add(DrinksList[Random.Range(0, DrinksList.Count)]); RandomDrinks.Add(DrinksList[Random.Range(0, DrinksList.Count)]); //Debug.Log("Slot machine generated something"); //Debug.Log(RandomDrinks[0].DrinkName); //Debug.Log(RandomDrinks[1].DrinkName); //Debug.Log(RandomDrinks[2].DrinkName); /* * Debug.Log(BACCalculator.CalculateEstimatedBACWidmark(2, PlayerStats.PlayerGender.MALE, 55, 1)); * Debug.Log(BACCalculator.CalculateEstimatedBACWidmark(2, PlayerStats.PlayerGender.MALE, 55, 2)); * Debug.Log(BACCalculator.CalculateEstimatedBACWidmark(2, PlayerStats.PlayerGender.MALE, 55, 3)); */ //Generate a random drinking period between 1 and 3.5 hours int DrinkingPeriodHours = Random.Range(1, 3); int DrinkingPeriodHalfHour = Random.Range(0, 2); GameTime DrinkingPeriod; DrinkingPeriod.Hours = DrinkingPeriodHours; DrinkingPeriod.Minutes = DrinkingPeriodHalfHour * 30; float DrinkingPeriodBAC = (float)DrinkingPeriodHours + ((float)DrinkingPeriodHalfHour * 0.5f); float TotalStandardDrinksConsumed = RandomDrinks[0].StandardDrinkEquivalence + RandomDrinks[1].StandardDrinkEquivalence + RandomDrinks[2].StandardDrinkEquivalence; float StartingBAC = BACCalculator.CalculateEstimatedBACWidmark(TotalStandardDrinksConsumed, PersistentData.GetPlayerStats().GetPlayerGender(), PersistentData.GetPlayerStats().GetPlayerWeight(), DrinkingPeriodBAC); PersistentData.GetPlayerStats().SetStartingBAC(StartingBAC); //Pass the drinking period to the player stats. PersistentData.GetPlayerStats().SetSlotMachineDrinkingPeriod(DrinkingPeriod); Debug.Log("Starting BAC: " + StartingBAC); //Debug.Log("Total standard drinks consumed: " + TotalStandardDrinksConsumed); //Debug.Log("Drinking period: " + DrinkingPeriod.Hours + "h " + DrinkingPeriod.Minutes + "m"); GameTime MetabolismTime = BACCalculator.CalculateMetabolismTime(StartingBAC); Debug.Log("Time to metabolise: " + MetabolismTime.Hours + "h " + MetabolismTime.Minutes + "m"); //Let the game manager know that the slot machine is finished, and it can advance to the main game. SlotMachineFinished(RandomDrinks); }
void UpdateCurrentBAC() { float DrinkingPeriod = timeManager.GameTimeToFloatTime(timeManager.GetElapsedGameTime()) + timeManager.GameTimeToFloatTime(PersistentData.GetPlayerStats().GetSlotMachineDrinkingPeriod()); float StandardDrinks = 0; SlotMachineDrink[] Drinks = PersistentData.GetPlayerStats().GetSlotMachineDrinks(); foreach (SlotMachineDrink drink in Drinks) { StandardDrinks += drink.StandardDrinkEquivalence; } float BAC = BACCalculator.CalculateEstimatedBACWidmark(StandardDrinks, PersistentData.GetPlayerStats().GetPlayerGender(), PersistentData.GetPlayerStats().GetPlayerWeight(), DrinkingPeriod); PersistentData.GetPlayerStats().SetCurrentBAC(BAC); //Debug.Log("BAC after: " + PersistentData.GetPlayerStats().GetCurrentBAC()); }