public void PerformGoldenAgeTasks() { if (GoldenAgeCanon.IsCivInGoldenAge(this)) { GoldenAgeCanon.ChangeTurnsOfGoldenAgeForCiv(this, -1); if (GoldenAgeCanon.GetTurnsLeftOnGoldenAgeForCiv(this) <= 0) { GoldenAgeCanon.StopGoldenAgeForCiv(this); } } else { int happiness = CivHappinessLogic.GetNetHappinessOfCiv(this); GoldenAgeCanon.ChangeGoldenAgeProgressForCiv(this, happiness); float progressTowards = GoldenAgeCanon.GetGoldenAgeProgressForCiv(this); float progressNeeded = GoldenAgeCanon.GetNextGoldenAgeCostForCiv(this); if (progressTowards >= progressNeeded) { GoldenAgeCanon.SetGoldenAgeProgressForCiv(this, 0f); GoldenAgeCanon.StartGoldenAgeForCiv(this, GoldenAgeCanon.GetGoldenAgeLengthForCiv(this)); } } }
public override void Refresh() { if (ObjectToDisplay == null) { return; } if (GoldenAgeCanon.IsCivInGoldenAge(ObjectToDisplay)) { TextField.SetText(string.Format( OneArgGoldenAgeFormat, GoldenAgeCanon.GetTurnsLeftOnGoldenAgeForCiv(ObjectToDisplay) )); } else { TextField.SetText(string.Format( TwoArgNonGoldenAgeFormat, GoldenAgeCanon.GetGoldenAgeProgressForCiv(ObjectToDisplay), GoldenAgeCanon.GetNextGoldenAgeCostForCiv(ObjectToDisplay) )); } }