예제 #1
0
 public bool OnTriggerStay(Collider other)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoTriggerStay(other);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
예제 #2
0
 public bool OnCollisionExit(Collision collisionInfo)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoCollisionExit(collisionInfo);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
예제 #3
0
 public bool OnAnimatorIK(int layerIndex)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoAnimatorIK(layerIndex);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
예제 #4
0
        public bool OnEvent(SkillEvent fsmEvent)
        {
            bool flag = false;

            for (int i = 0; i < this.ActiveActions.get_Count(); i++)
            {
                SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
                fsmStateAction.Init(this);
                flag = fsmStateAction.Event(fsmEvent);
            }
            return(this.fsm.IsSwitchingState || flag);
        }
예제 #5
0
 public void OnUpdate()
 {
     if (this.finished)
     {
         return;
     }
     this.StateTime += Time.get_deltaTime();
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.OnUpdate();
     }
     this.CheckAllActionsFinished();
 }
예제 #6
0
 public void OnExit()
 {
     this.active   = false;
     this.finished = false;
     SkillStateAction[] array = this.Actions;
     for (int i = 0; i < array.Length; i++)
     {
         SkillStateAction fsmStateAction = array[i];
         if (fsmStateAction.Entered)
         {
             this.activeAction = fsmStateAction;
             fsmStateAction.Init(this);
             fsmStateAction.OnExit();
         }
     }
 }
        private static void CheckActionForErrors(SkillState state, SkillStateAction action)
        {
            if (action == null)
            {
                FsmErrorChecker.AddError(new FsmError(state, null, Strings.get_FsmErrorChecker_MissingActionError()));
                return;
            }
            action.Init(state);
            FsmErrorChecker.fsmEventTargetContext = null;
            string actionLabel = Labels.GetActionLabel(action);

            if (FsmEditorSettings.CheckForMissingActions && action is MissingAction)
            {
                FsmErrorChecker.AddError(new FsmError(state, action, Strings.get_FsmErrorChecker_StateHasMissingActionError()));
                return;
            }
            if (FsmEditorSettings.CheckForObsoleteActions)
            {
                string obsoleteMessage = CustomAttributeHelpers.GetObsoleteMessage(action.GetType());
                if (!string.IsNullOrEmpty(obsoleteMessage))
                {
                    FsmErrorChecker.AddError(new FsmError(state, action, obsoleteMessage));
                }
            }
            Type type = action.GetType();

            FieldInfo[] fields = ActionData.GetFields(type);
            FieldInfo[] array  = fields;
            for (int i = 0; i < array.Length; i++)
            {
                FieldInfo fieldInfo = array[i];
                Type      fieldType = fieldInfo.get_FieldType();
                object    value     = fieldInfo.GetValue(action);
                if (fieldType == typeof(SkillEventTarget))
                {
                    SkillEventTarget fsmEventTarget = (SkillEventTarget)value;
                    if (actionLabel == "Set Event Target")
                    {
                        FsmErrorChecker.fsmEventTargetContextGlobal = fsmEventTarget;
                    }
                    else
                    {
                        FsmErrorChecker.fsmEventTargetContext = fsmEventTarget;
                    }
                }
                FsmErrorChecker.CheckActionParameter(state, action, fieldInfo);
            }
            string text = "";

            try
            {
                text = action.ErrorCheck();
            }
            catch (Exception ex)
            {
                Debug.Log(string.Concat(new object[]
                {
                    "Bad ErrorCheck: ",
                    type,
                    "\n",
                    ex
                }));
            }
            if (!string.IsNullOrEmpty(text))
            {
                FsmErrorChecker.AddError(new FsmError(state, action, text));
            }
        }