public static List <SkillInfo> FindStatesUsingAction(Skill fsm, Type actionType) { List <SkillInfo> list = new List <SkillInfo>(); SkillState[] states = fsm.get_States(); for (int i = 0; i < states.Length; i++) { SkillState fsmState = states[i]; if (fsmState.get_ActionsLoaded()) { int num = 0; SkillStateAction[] actions = fsmState.get_Actions(); for (int j = 0; j < actions.Length; j++) { SkillStateAction fsmStateAction = actions[j]; if (fsmStateAction.GetType() == actionType) { list.Add(new SkillInfo { fsm = fsm, state = fsmState, action = fsmStateAction, actionIndex = num }); } num++; } } } return(list); }
private void DoSearch() { this.UpdateVariableList(); this.FindEventsInGlobalTransitions(); SkillState[] states = this.fsm.get_States(); for (int i = 0; i < states.Length; i++) { SkillState fsmState = states[i]; fsmState.set_Fsm(this.fsm); this.FindEventUsage(fsmState); SkillStateAction[] actions = fsmState.get_Actions(); for (int j = 0; j < actions.Length; j++) { SkillStateAction fsmStateAction = actions[j]; SkillSearch.currentInfo = new SkillInfo { fsm = this.fsm, state = fsmState, action = fsmStateAction }; this.FindEventsSentBy(fsmStateAction); this.FindVariableUsage(fsmStateAction, 0); } } this.UpdateUnusedEvents(); this.UpdateUnusedVariables(); }
public static void MoveActionToBottom(SkillState state, SkillStateAction action) { if (state == null || action == null) { return; } List <SkillStateAction> list = new List <SkillStateAction>(state.get_Actions()); int num = list.IndexOf(action); if (num == state.get_Actions().Length - 1) { return; } SkillEditor.RegisterUndo(Strings.get_Menu_Move_Action_To_Bottom()); list.Remove(action); list.Add(action); state.set_Actions(list.ToArray()); SkillEditor.SaveActions(action.get_State(), false); }
public static void MoveActionDown(SkillState state, SkillStateAction action) { if (state == null || action == null) { return; } List <SkillStateAction> list = new List <SkillStateAction>(state.get_Actions()); int num = list.IndexOf(action); if (num == state.get_Actions().Length - 1) { return; } SkillEditor.RegisterUndo(Strings.get_Command_Move_Action_Down()); list.Remove(action); list.Insert(num + 1, action); state.set_Actions(list.ToArray()); SkillEditor.SaveActions(action.get_State(), false); }
public static void OpenAllActions(SkillState state, bool openState) { SkillStateAction[] actions = state.get_Actions(); for (int i = 0; i < actions.Length; i++) { SkillStateAction fsmStateAction = actions[i]; fsmStateAction.set_IsOpen(openState); } SkillEditor.SaveActions(state, false); }
public static void EnableAllActions(SkillState state, bool enabledState) { SkillEditor.RegisterUndo(Strings.get_Command_Enable_All_Actions()); SkillStateAction[] actions = state.get_Actions(); for (int i = 0; i < actions.Length; i++) { SkillStateAction fsmStateAction = actions[i]; fsmStateAction.set_Enabled(enabledState); } SkillEditor.SaveActions(state, true); }
public static void MoveActionAfter(SkillState state, SkillStateAction action, SkillStateAction afterAction) { if (state == null || action == null || afterAction == null) { return; } List <SkillStateAction> list = new List <SkillStateAction>(state.get_Actions()); list.Remove(action); int num = Mathf.Clamp(list.IndexOf(afterAction) + 1, 0, list.get_Count()); list.Insert(num, action); state.set_Actions(list.ToArray()); SkillEditor.SaveActions(action.get_State(), false); }
public static int GetActionIndex(SkillState state, SkillStateAction action) { int num = 0; SkillStateAction[] actions = state.get_Actions(); for (int i = 0; i < actions.Length; i++) { SkillStateAction fsmStateAction = actions[i]; if (fsmStateAction == action) { return(num); } num++; } return(-1); }
public static void MoveActionToTop(SkillState state, SkillStateAction action) { if (state == null || action == null) { return; } List <SkillStateAction> list = new List <SkillStateAction>(state.get_Actions()); if (list.IndexOf(action) == 0) { return; } SkillEditor.RegisterUndo(Strings.get_Menu_Move_Action_To_Top()); list.Remove(action); list.Insert(0, action); state.set_Actions(list.ToArray()); SkillEditor.SaveActions(action.get_State(), false); }
private static void DoCheckFsmForErrors(Skill fsm) { if (fsm == null || fsm.get_OwnerObject() == null) { return; } PlayMakerFSM playMakerFSM = fsm.get_Owner() as PlayMakerFSM; if (playMakerFSM != null && playMakerFSM.get_UsesTemplate()) { return; } try { fsm.InitData(); FsmErrorChecker.checkingFsm = fsm; FsmErrorChecker.ClearFsmErrors(fsm); SkillState[] states = fsm.get_States(); for (int i = 0; i < states.Length; i++) { SkillState fsmState = states[i]; fsmState.set_Fsm(fsm); FsmErrorChecker.fsmEventTargetContextGlobal = null; SkillStateAction[] actions = fsmState.get_Actions(); for (int j = 0; j < actions.Length; j++) { SkillStateAction fsmStateAction = actions[j]; if (fsmStateAction.get_Enabled()) { FsmErrorChecker.CheckActionForErrors(fsmState, fsmStateAction); } } FsmErrorChecker.CheckTransitionsForErrors(fsmState); } FsmErrorChecker.CheckActionReportForErrors(); } catch (Exception ex) { Debug.LogError(ex.ToString()); throw; } SkillEditor.RepaintAll(); }
public static List <SkillInfo> FindActionsUsingEvent(SkillState state, string eventName) { List <SkillInfo> list = new List <SkillInfo>(); int num = 0; SkillStateAction[] actions = state.get_Actions(); for (int i = 0; i < actions.Length; i++) { SkillStateAction fsmStateAction = actions[i]; SkillInfo.currentInfo = new SkillInfo { fsm = state.get_Fsm(), state = state, action = fsmStateAction, actionIndex = num }; list.AddRange(SkillInfo.FindEventUsage(fsmStateAction, eventName)); num++; } return(list); }