private void OnEnable() { this.PauseGame(); var lHiveController = FindObjectOfType <HiveController>(); var lPlayerController = FindObjectOfType <PlayerController>(); var lGameState = GameController.instance.GameState; var lDayStats = StatisticsSet.CreateEmpty(); lDayStats.Set(StatisticKeys.PollenPickupCount, lPlayerController.PollenPickupCount); lDayStats.Set(StatisticKeys.PollenCollected, lHiveController.CurrentPollen); lDayStats.Set(StatisticKeys.HiveDropOffCount, lHiveController.PollenDropOffCount); lDayStats.Set(StatisticKeys.RemainingPollen, lPlayerController.CurrentPollen); lDayStats.Set(StatisticKeys.TotalDistanceTraveled, lPlayerController.TotalDistanceTraveled); // TODO lDayStats.Set(StatisticKeys.TotalFlowersCollected, 0); lDayStats.Set(StatisticKeys.FurthestDistanceTraveled, 0); lGameState.FinializeDay(lDayStats); GameController.instance.Save(); this.AddFormField("Collected Pollen", lDayStats.GetString(StatisticKeys.PollenCollected, "0.00")); this.AddFormField("Salvaged Pollen", lDayStats.GetString(StatisticKeys.SalvagedPollen, "0.00")); this.AddFormField("Available Pollen", lGameState.Statistics.GetString(StatisticKeys.RemainingPollen, "0.00")); this.AddFormField("Batches Processed", lDayStats.GetString(StatisticKeys.HoneyBatchCount, "0.00")); this.AddFormField("Pollen Used", lDayStats.GetString(StatisticKeys.PollenProcessed, "0.00")); this.AddFormField("Honey Produced", lDayStats.GetString(StatisticKeys.HoneyProduced, "0.00")); this.AddFormField("Total Honey", lGameState.Statistics.GetString(StatisticKeys.HoneyAvailable, "0.00")); }
public StatisticsSet GenerateHoney(StatisticsSet stats, AttributeSet attributes) { var lPollenRequirement = attributes.GetDouble(AttributeKeys.PollenRequirement); var lMaximumBatchCount = Math.Floor(attributes.GetDouble(AttributeKeys.HoneyBatchCount)); var lTheoreticalBatchCount = Math.Floor(stats.GetDouble(StatisticKeys.RemainingPollen) / lPollenRequirement); var lBatchCount = (long)Math.Min(lMaximumBatchCount, lTheoreticalBatchCount); var lPollenRequired = lBatchCount * lPollenRequirement; var lHoneyGenerated = lBatchCount * attributes.GetDouble(AttributeKeys.HoneyYield); stats.Decrement(StatisticKeys.RemainingPollen, lPollenRequired); stats.Increment(StatisticKeys.HoneyAvailable, lHoneyGenerated); var lResult = StatisticsSet.CreateEmpty(); lResult.Set(StatisticKeys.HoneyBatchCount, lBatchCount); lResult.Set(StatisticKeys.PollenProcessed, lPollenRequired); lResult.Set(StatisticKeys.HoneyProduced, lHoneyGenerated); return(lResult); }