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));
            }
        }
Example #2
0
 public ChallengeCompletedEvent(ChallengeModel model)
 {
     Model = model;
 }
Example #3
0
 public void UpdateForChallenge(ChallengeModel model)
 {
     Label.text    = model.Type.ToString();
     Progress.text = string.Format("{0}/{1}", model.Progress, model.Target);
 }