Пример #1
0
 /*
  *  private CampaignData GatherOneCampaign (int idx) {
  *    CampaignData cd = new CampaignData ();
  *    CampaignManager cm = Registry.only.GetObject<CampaignManager> (idx);
  *    cd.Title = cm.cname;
  *    cd.Description = cm.CampaignDescription;
  *    cd.StartMessage = cm.StartingInfo;
  *    cd.WinMessage = cm.SuccessInfo;
  *    cd.LoseMessage = cm.FailureInfo;
  *    cd.PlayerName = cm.PlayerOverlayNames;
  *    cd.OverlayCount = cm.CampaignOverlayNames.Length;
  *    cd.LevelCount = cm.Levels.Length;
  *    cd.CurrentLevel = cm.currentLevel;
  *    cd.IsActive = cm.isActive;
  *    cd.RegistryIndex = cm.ListIndex;
  *    cd.ActualIndex = idx;
  *    return cd;
  *  }
  *
  *  public CampaignData[] GatherAllCampaign () {
  *    List<CampaignData> allcd = new List<CampaignData> ();
  *    int ccmax = Registry.only.GetCount<CampaignManager> ();
  *    for (int cc = 0; cc < ccmax; cc++) {
  *      allcd.Add (GatherOneCampaign (cc));
  *    }
  *    return allcd.ToArray ();
  *  }
  *
  */
 public Status GoalStateToStatus(GoalManager.GoalState gs)
 {
     // TODO: Consolidate all these states and statuses.
     if (gs == GoalManager.GoalState.neutral)
     {
         return(Status.active);
     }
     if (gs == GoalManager.GoalState.assumewin)
     {
         return(Status.assumewin);
     }
     if (gs == GoalManager.GoalState.assumelose)
     {
         return(Status.assumelose);
     }
     if (gs == GoalManager.GoalState.realwin)
     {
         return(Status.haswon);
     }
     if (gs == GoalManager.GoalState.reallose)
     {
         return(Status.haslost);
     }
     return(Status.inactive);
 }
Пример #2
0
        void Start()
        {
#if FULLLOG
            MoreDebug.Log("go: " + gameObject.name);
#endif
            RegisterSelf();
            int goalbias = 0;
            foreach (GoalManager goal in goals)
            {
                goal.SuccessEvent.AddListener(IncrementSuccess);
                goal.FailureEvent.AddListener(IncrementFailure);
                if (goal.ForceMissionSuccess)
                {
                    goal.SuccessEvent.AddListener(SucceedMission);
                }
                if (goal.ForceMissionFail)
                {
                    goal.FailureEvent.AddListener(FailMission);
                }
                if (goal.initialState == GoalManager.GoalState.assumewin)
                {
                    goalbias++;
                }
                else if (goal.initialState == GoalManager.GoalState.assumelose)
                {
                    goalbias--;
                }
            }
            if (goalbias < 0)
            {
                initialState = GoalManager.GoalState.assumelose;
            }
            else if (goalbias > 0)
            {
                initialState = GoalManager.GoalState.assumewin;
            }
            else
            {
                initialState = GoalManager.GoalState.neutral;
            }
            currentState = initialState;
        }
Пример #3
0
 public Status GoalStateToStatus(GoalManager.GoalState gs)
 {
     if (gs == GoalManager.GoalState.neutral)
     {
         return(Status.active);
     }
     if (gs == GoalManager.GoalState.assumewin)
     {
         return(Status.assumewin);
     }
     if (gs == GoalManager.GoalState.assumelose)
     {
         return(Status.assumelose);
     }
     if (gs == GoalManager.GoalState.realwin)
     {
         return(Status.haswon);
     }
     if (gs == GoalManager.GoalState.reallose)
     {
         return(Status.haslost);
     }
     return(Status.inactive);
 }