void UpdateChallenge(ref ChallengeModel model) { if (model.Completed) { return; } switch (model.Type) { case ChallengeType.PopulationTotal: model.Progress = 0; // TODO break; case ChallengeType.PowerOutput: model.Progress = Mathf.Min(PlayerBuildingManager.GetTotalPowerOutput(), model.Target); break; case ChallengeType.TotalCash: model.Progress = Mathf.Min(FundManager.Funds, model.Target); break; } if (model.Completed) { EventSystem.Publish(new ChallengeCompletedEvent(model)); } }
public ChallengeCompletedEvent(ChallengeModel model) { Model = model; }
public void UpdateForChallenge(ChallengeModel model) { Label.text = model.Type.ToString(); Progress.text = string.Format("{0}/{1}", model.Progress, model.Target); }