Exemple #1
0
        public static SkillStateAction AddAction(SkillState state, Type actionType, ActionTarget actionTarget, Object targetObject = null, SkillStateAction beforeAction = null)
        {
            SkillStateAction fsmStateAction = SkillEditor.Builder.InsertAction(state, actionType, beforeAction);

            if (!string.IsNullOrEmpty(actionTarget.get_FieldName()))
            {
                string[] array = actionTarget.get_FieldName().Split(new char[]
                {
                    ','
                });
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string text = array2[i];
                    ActionUtility.SetActionFieldValue(fsmStateAction, text.Trim(), targetObject);
                }
            }
            fsmStateAction.OnActionTargetInvoked(targetObject);
            SkillEditor.SaveActions(state, true);
            return(fsmStateAction);
        }