private MetricManager() { this.PopHappiness = START_VALUE; this.Gold = START_VALUE; this.EnvHealth = START_VALUE; this.PrevGold = START_VALUE; this.PrevEnvHealth = START_VALUE; this.PrevPopHappiness = START_VALUE; campaignWeightings = new CampaignWeightings(0, 0, 0); }
/// <summary> /// Updates the MetricManager of the weightings from the campaign such that decisions affecting the most heavily weighted metric /// also impact population happiness. Currently only the most heavily weighted metric is used. And the player must receive at least a score /// of three for weightings to be applied. /// </summary> private void UpdateMetricManagerWeightings() { var campaignWeightingsArray = new float[3] { 0, 0, 0 }; var scoresList = new List <int>(new int[3] { popHappinessScore, goldScore, environmentalScore }); var maxScore = scoresList.Max(); if (maxScore >= 3) { var maxScoreIndex = scoresList.IndexOf(maxScore); Debug.Log("Max Score: " + maxScore); campaignWeightingsArray[maxScoreIndex] = maxScore / 10f; } currentWeightings = new CampaignWeightings(campaignWeightingsArray[0], campaignWeightingsArray[1], campaignWeightingsArray[2]); MetricManager.Instance.campaignWeightings = currentWeightings; }