private void OnAnimatorIK(int layerIndex)
    {
#if false
        bool disableRightHandIK = false;
        bool disableLeftHandIK  = false;

        if (m_player.IsDead())
        {
            disableRightHandIK = true;
            disableLeftHandIK  = true;
        }

        //if the player is holding a weapon in their right hand
        if (!HandleHandIK(EPlayerHand.HAND_RIGHT))
        {
            disableRightHandIK = true;
        }
        if (!HandleHandIK(EPlayerHand.HAND_LEFT))
        {
            disableLeftHandIK = true;
        }

        if (disableRightHandIK)
        {
            m_player.m_animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 0.0f);
            m_player.m_animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 0.0f);
        }
        if (disableLeftHandIK)
        {
            m_player.m_animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0.0f);
            m_player.m_animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0.0f);
        }
#endif
    }
예제 #2
0
 private void UI_DisplayInteractions()
 {
     if (!m_player.IsDead())
     {
         if (m_player.IsItemNearby())
         {
             GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2, 200, 30), "Press 'F' To Pick Up");
         }
         else if (m_player.IsInteractableNearby())
         {
             GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2, 200, 30), "Press 'F' To Interact");
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (GetInputEnabled())
        {
            if (!m_player.IsDead())
            {
                if (GameOptions.GetSwapRightLeftClick() ? Input.GetKeyDown(KeyCode.Mouse0) : Input.GetKeyDown(KeyCode.Mouse1))
                {
                    m_player.PrimaryAction();
                }
                if (GameOptions.GetSwapRightLeftClick() ? Input.GetKeyDown(KeyCode.Mouse1) : Input.GetKeyDown(KeyCode.Mouse0))
                {
                    m_player.SecondaryAction();
                }
                if (GameOptions.GetSwapRightLeftClick() ? Input.GetKey(KeyCode.Mouse0) : Input.GetKey(KeyCode.Mouse1))
                {
                    m_player.AutoPrimaryAction();
                }
                if (GameOptions.GetSwapRightLeftClick() ? Input.GetKey(KeyCode.Mouse1) : Input.GetKey(KeyCode.Mouse0))
                {
                    m_player.AutoSecondaryAction();
                }


                //Reload
                if (Input.GetKeyDown(KeyCode.R))
                {
                    m_player.m_playerWeaponHolder.ReloadRangedWeapons();
                }

                //Pickup items
                if (Input.GetKeyDown(KeyCode.F))
                {
                    m_player.AttemptInteraction();
                }

                if (Input.GetKeyDown(KeyCode.Q))
                {
                    m_player.m_playerAugmentHandler.UseAugment(EAugmentSlot.Q);
                }
                if (Input.GetKeyDown(KeyCode.E))
                {
                    m_player.m_playerAugmentHandler.UseAugment(EAugmentSlot.E);
                }
                if (Input.GetKeyDown(KeyCode.Space))
                {
                    m_player.m_playerAugmentHandler.UseAugment(EAugmentSlot.SPACE);
                }

                m_player.SetMovementValues(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
                m_player.SetDirectionInput(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

                //camera input
                if (Input.GetMouseButtonDown(2))
                {
                    Camera_Main.GetMainCamera().CycleCameraViewMode();
                }

                if (Input.GetKeyDown(KeyCode.LeftShift))
                {
                    Camera_Main.GetMainCamera().SetForceZoom(true);
                }
                else if (Input.GetKeyUp(KeyCode.LeftShift))
                {
                    Camera_Main.GetMainCamera().SetForceZoom(false);
                }
            }
        }


        //loadout
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (UIScreen_Manager.Instance.GetCurrentUIScreenAsEnum() == EUIScreen.LOADOUT_MENU)
            {
                UIScreen_Manager.Instance.GoToUIScreen(EUIScreen.INGAME_HUD);
            }
            else if (!m_player.IsDead())
            {
                UIScreen_Manager.Instance.GoToUIScreen(EUIScreen.LOADOUT_MENU);
            }
        }

        //updated desired rotation (should work whilst dead)
        if (IsHUDActive())
        {
            m_player.m_playerRotator.AddDesiredRotation(Input.GetAxis("Mouse X"));
            Camera_Main.GetMainCamera().MinusCurrentRotationY(Input.GetAxis("Mouse Y"));
        }

        //freecam mode
        if (Input.GetKeyDown(KeyCode.C))
        {
            m_player.m_playerRotator.SetDisabledRotation(!m_player.m_playerRotator.GetDisabledRotation());
            SetEnableInput(!m_player.m_playerRotator.GetDisabledRotation());
        }
    }