public static AC.Action RebuildAction(AC.Action action, int typeIndex, ResultAction _resultAction, int _skipAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene) { ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; if (actionsManager) { string className = actionsManager.AllActions [typeIndex].fileName; if (action.GetType().ToString() != className && action.GetType().ToString() != ("AC." + className)) { bool _showComment = action.showComment; bool _showOutputSockets = action.showOutputSockets; string _comment = action.comment; action = (AC.Action)CreateInstance(className); action.endAction = _resultAction; action.skipAction = _skipAction; action.linkedAsset = _linkedAsset; action.linkedCutscene = _linkedCutscene; action.showComment = _showComment; action.showOutputSockets = _showOutputSockets; action.comment = _comment; } } return(action); }
public static AC.Action RebuildAction(AC.Action existingAction, int typeIndex, ActionList _target, int insertIndex = -1, ActionEnd _end = null) { ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; int existingIndex = _target.actions.IndexOf(existingAction); if (actionsManager) { string className = actionsManager.AllActions [typeIndex].fileName; if (existingAction.GetType().ToString() != className && existingAction.GetType().ToString() != ("AC." + className)) { bool _showComment = existingAction.showComment; bool _showOutputSockets = existingAction.showOutputSockets; string _comment = existingAction.comment; ActionList _parentActionListInEditor = existingAction.parentActionListInEditor; AC.Action newAction = (AC.Action)CreateInstance(className); if (newAction == null && !className.StartsWith("AC.")) { newAction = (AC.Action)CreateInstance("AC." + className); } if (newAction == null) { newAction = (AC.Action)CreateInstance(ActionsManager.GetDefaultAction()); } newAction.name = className; if (_end != null) { newAction.endAction = _end.resultAction; newAction.skipAction = _end.skipAction; newAction.linkedAsset = _end.linkedAsset; newAction.linkedCutscene = _end.linkedCutscene; } newAction.showComment = _showComment; newAction.showOutputSockets = _showOutputSockets; newAction.comment = _comment; newAction.parentActionListInEditor = _parentActionListInEditor; if (insertIndex >= 0) { _target.actions.Insert(insertIndex, newAction); } else if (existingIndex >= 0) { _target.actions[existingIndex] = newAction; } //SyncAssetObjects (_target); return(newAction); } } return(existingAction); }