示例#1
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);
        }
示例#2
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();
        }
示例#3
0
        private void startPropInteraction()
        {
            if (PlayerHandle.IsNull || !dataEntityCollection.TryGetComponent <GameObjectReferenceData>(PlayerHandle, out var component))
            {
                return;
            }
            Animator component2 = component.GameObject.GetComponent <Animator>();

            if (component2 != null)
            {
                AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(component2, 1);
                if (!LocomotionUtils.IsHolding(animatorStateInfo))
                {
                    component2.Play(AnimationHashes.States.TorsoHold, AnimationHashes.Layers.Torso);
                }
            }
            ParticipationController component3 = component.GameObject.GetComponent <ParticipationController>();

            if (component3 != null)
            {
                component3.StartParticipation(new ParticipationRequest(ParticipationRequest.Type.Start, Prop.gameObject, "PropUser"));
            }
        }