Ejemplo n.º 1
0
        public override void OnEnter()
        {
            bool     flag      = false;
            PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();

            if (component != null && component.Prop != null)
            {
                flag = component.Prop.PropId == propDefinition.GetNameOnServer();
                if (flag)
                {
                    Animator componentInParent = base.Owner.GetComponentInParent <Animator>();
                    if (componentInParent != null)
                    {
                        AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(componentInParent, 1);
                        flag = LocomotionUtils.IsHolding(animatorStateInfo) || LocomotionUtils.IsRetrieving(animatorStateInfo);
                    }
                    else
                    {
                        LogWarning("Failed to get the animator controller. IsHoldingPropAction could only determine that the owner has a prop component and did not check the animator's state.");
                    }
                }
            }
            if (flag)
            {
                base.Fsm.Event(OnTrueEvent);
            }
            else
            {
                base.Fsm.Event(OnFalseEvent);
            }
            Finish();
        }
Ejemplo n.º 2
0
        private int hasEquippedProp()
        {
            bool     flag      = false;
            int      result    = -1;
            PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();

            if (component != null && component.Prop != null)
            {
                int num = PropDefinition.Length;
                for (int i = 0; i < num; i++)
                {
                    flag = component.Prop.PropId == PropDefinition[i].GetNameOnServer();
                    if (flag)
                    {
                        result = i;
                        break;
                    }
                }
                if (flag)
                {
                    Animator componentInParent = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponentInParent <Animator>();
                    if (componentInParent != null)
                    {
                        AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(componentInParent, 1);
                        flag = LocomotionUtils.IsHolding(animatorStateInfo) || LocomotionUtils.IsRetrieving(animatorStateInfo);
                    }
                }
            }
            if (!flag)
            {
                result = -1;
            }
            return(result);
        }