Пример #1
0
        public virtual void Init()
        {
            animator = GetComponent <Animator>();
            if (animator)
            {
                hitDirectionHash      = new AnimatorParameter(animator, "HitDirection");
                reactionIDHash        = new AnimatorParameter(animator, "ReactionID");
                triggerReactionHash   = new AnimatorParameter(animator, "TriggerReaction");
                triggerResetStateHash = new AnimatorParameter(animator, "ResetState");
                recoilIDHash          = new AnimatorParameter(animator, "RecoilID");
                triggerRecoilHash     = new AnimatorParameter(animator, "TriggerRecoil");
            }

            var actionListeners = GetComponents <vActions.vActionListener>();

            for (int i = 0; i < actionListeners.Length; i++)
            {
                if (actionListeners[i].actionEnter)
                {
                    onActionEnter.AddListener(actionListeners[i].OnActionEnter);
                }
                if (actionListeners[i].actionStay)
                {
                    onActionStay.AddListener(actionListeners[i].OnActionStay);
                }
                if (actionListeners[i].actionExit)
                {
                    onActionExit.AddListener(actionListeners[i].OnActionExit);
                }
            }
        }
Пример #2
0
        public virtual void Init()
        {
            var actionListeners = GetComponents <ActionListener>();

            for (int i = 0; i < actionListeners.Length; i++)
            {
                if (actionListeners[i].actionEnter)
                {
                    onActionEnter.AddListener(actionListeners[i].OnActionEnter);
                }
                if (actionListeners[i].actionStay)
                {
                    onActionStay.AddListener(actionListeners[i].OnActionStay);
                }
                if (actionListeners[i].actionExit)
                {
                    onActionExit.AddListener(actionListeners[i].OnActionExit);
                }
            }
        }