Exemplo n.º 1
0
        private bool CoverAroundTrigger(bool intentionalEnter = false)
        {
            if (!TriggS.LastValue.GetTrigger(CoverSystemTriggers.ct_Cover) || !coverChecker.HaveCoverAround || IsInCover)
            {
                return(false);
            }

            if (userInput.CoverDown || intentionalEnter)
            {
                Events.InvokeOnCoverEnter();
                userInput.m_CoverDown = false;

                player.SmbLoco.OverrideToDeactivatedLayer(new DeactivatedLocomLayerParams(true), -1, c_OverrideKey);

                player.SmbWeapon.TriggS.Override(c_OverrideKey, 1, new WeaponSystemTriggers(false));
                player.SmbThrow.TriggS.Override(c_OverrideKey, 1, new ThrowSystemTriggers(false));

                LayerWeightTarget = 1;
                animator.SetFloat(cap_CrouchStand, 1);

                calced_CoverNormal = coverChecker.CoverWallNormalAround;
                calced_GroundPoint = coverChecker.CoverGroundPositionAround;

                animator.SetInteger(cap_Cover, 1);

                // Cover side is least angle side with player forward
                Vector3 fromPlToPointWPointY =
                    (-new Vector3(transform.position.x, calced_GroundPoint.y, transform.position.z) + calced_GroundPoint).normalized;
                float angle = Vector3.Dot(fromPlToPointWPointY, transform.right) * Vector3.Angle(fromPlToPointWPointY, transform.right);
                animator.SetFloat(cap_CoverSide, Mathf.Sign(angle));

                playerCamera.OverrideCamera(Mathf.Sign(angle) < 0 ? CCoverProps.cameraModifiersIdleLeft : CCoverProps.cameraModifiersIdleRight, -1, c_OverrideKey);

                player.GetComponent <Rigidbody>().isKinematic = true;
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (stateInfo.shortNameHash == h_Empty)
            {
                _mirroredAnimDoubleHandOnCall_IsCalled = false;

                player.SmbWeapon.LeftHandEnabled = true;

                UpperBodyLayerTarget = 0;

                ReleaseTriggers();
            }
            else if (stateInfo.shortNameHash == h_PullOut)
            {
                SetThrowable(nextThrowableIndex);
                if (cExploderPrefab.leftHandHoldPositionRotation && !UseMirrorThrow)
                {
                    leftHandHold.localRotation = cExploderPrefab.leftHandHoldPositionRotation.localRotation;
                    leftHandHold.localPosition = cExploderPrefab.leftHandHoldPositionRotation.localPosition;
                }
                else if (cExploderPrefab.rightHandHoldPositionRotation && UseMirrorThrow)
                {
                    rightHandHold2.localRotation = cExploderPrefab.rightHandHoldPositionRotation.localRotation;
                    rightHandHold2.localPosition = cExploderPrefab.rightHandHoldPositionRotation.localPosition;
                }

                if (cExploderPrefab)
                {
                    cExploderPrefab.PlayRandomSoundAsWeaponChild(cExploderPrefab.sounds.pulls, transform, true, transform);
                }
            }
            else if (stateInfo.shortNameHash == h_ToReady)
            {
                animator.SetInteger(cap_Throw, 1);
            }
            else if (stateInfo.shortNameHash == h_ReadyIdle)
            {
                throwDir = Quaternion.AngleAxis(-cExploderClone.additionalThrowAngleHorizontal, playerCamera.transform.right) * playerCamera.transform.forward;

                if (IndicatorTrigger() /*|| 1 == 1*/)
                {
                    if (!playerCamera.IsOverridenWithKey(c_overrideKey))
                    {
                        if (!player.SmbCover.IsInCover)
                        {
                            playerCamera.OverrideCamera(CThrowProps.cameraProps, 1, c_overrideKey);
                        }
                        else if (playerCamera.IsOverridenWithKey(c_overrideKey))
                        {
                            playerCamera.ChangePointerOfCamModderWithID(CThrowProps.cameraProps, c_overrideKey);
                        }
                    }
                }
            }
            else if (stateInfo.shortNameHash == h_Throw)
            {
                if (cExploderClone)
                {
                    cExploderClone.PlayRandomSoundAsWeaponChild(cExploderPrefab.sounds.throws, transform, transform);
                }
            }
        }