private void addPlayMakerFSM(GameObject player) { playMakerFsm = player.AddComponent <PlayMakerFSM>(); playMakerFsm.Fsm.Name = Definition.name; try { playMakerFsm.SetFsmTemplate(fsmTemplate); } catch (Exception ex) { Log.LogException(this, ex); } foreach (FsmState fsmState in getFsmStates()) { ObjectiveAction objectiveAction = getObjectiveAction(fsmState); if (objectiveAction != null) { allObjectiveNames.Add(fsmState.Name); sortedObjectives.Add(fsmState.Name); ObjectiveRewardIndexes[fsmState.Name] = objectiveAction.DefinitionRewardIndex; if (CurrentObjectiveName == null) { CurrentObjectiveName = fsmState.Name; } } } }
private void restoreFromCompletedObjectives() { if (Definition.Prototyped) { return; } foreach (FsmState fsmState in getFsmStates()) { ObjectiveAction objectiveAction = getObjectiveAction(fsmState); if (objectiveAction != null) { if (!serverControlledAllTimeCompletedObjectives.Contains(fsmState.Name)) { trace("Objective name not found: " + fsmState.Name + " " + serverControlledAllTimeCompletedObjectives.Count); break; } CurrentObjectiveName = getNextState(fsmState).Name; trace("Setting CurrentObjectiveName = " + CurrentObjectiveName + " " + serverControlledAllTimeCompletedObjectives.Count); } } }