Ejemplo n.º 1
0
    public void Update()
    {
        NormalMovement();

        //Reset MovingState
        if (_Velocity.magnitude < Vector3.one.magnitude && Player_Controller.MovingState == Player_Controller.MovingStates.Running)
        {
            Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Walking);
        }
    }
Ejemplo n.º 2
0
    IEnumerator ReloadCO()
    {
        yield return(new WaitForSeconds(GunAnimation.clip.length));

        ReloadStuff();

        Player_Controller.CombatState = Player_Controller.CombatStates.Idle;

        if (Player_Controller.MovingState == Player_Controller.MovingStates.Running)
        {
            Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Running);
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        #region Interact

        if (Input.GetKeyDown(KeyCode.E))
        {
            if (Player_Controller.m_Interact.CurrentInteractable)
            {
                Player_Controller.m_Interact.CurrentInteractable.OnInteract();
            }
        }

        #endregion

        #region GUN

        if (Player_Controller.CombatState != Player_Controller.CombatStates.Reloading && Player_Controller.m_Gun.ActiveGun)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                if (Player_Controller.MovingState == Player_Controller.MovingStates.Running)
                {
                    Player_Controller.m_Gun.GunStats.PlayAim();
                }
                else
                {
                    Player_Controller.CombatState = Player_Controller.CombatStates.Shooting;
                }
            }
            if (Input.GetButton("Fire1") && Player_Controller.MovingState != Player_Controller.MovingStates.Running)
            {
                Player_Controller.m_Gun.Shootig();
            }
            if (Input.GetButtonUp("Fire1"))
            {
                Player_Controller.m_Gun.ResetWeapon();
            }
            //AIM
            if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                Player_Controller.Aim();
            }
            //PUT GUN DOWN
            if (Input.GetKeyUp(KeyCode.Mouse1) && Player_Controller.Aiming)
            {
                Player_Controller.PutGunDown();
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                Player_Controller.m_Gun.ReloadWeapon();
            }
        }

        // Change Weapon
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (Player_Controller.m_Gun.PrimaryWeapon && Player_Controller.m_Gun.ActiveGun != Player_Controller.m_Gun.PrimaryWeapon)
            {
                Player_Controller.m_Gun.GetNewWeapon(Player_Controller.m_Gun.PrimaryWeapon);
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (Player_Controller.m_Gun.SecondaryWeapon && Player_Controller.m_Gun.ActiveGun != Player_Controller.m_Gun.SecondaryWeapon)
            {
                Player_Controller.m_Gun.GetNewWeapon(Player_Controller.m_Gun.SecondaryWeapon);
            }
        }

        #endregion

        #region MOVEMENT
        Player_Controller.m_Movement.SetMoveDirection(GetMovementAxis());

        // JUMP START
        if (Input.GetButtonDown("Jump"))
        {
            Player_Controller.m_Movement.StartJump();
        }
        // JUMP END
        if (Input.GetButtonUp("Jump"))
        {
            Player_Controller.m_Movement.EndJump();
        }
        //RUN START
        if (Input.GetButtonDown("Fire3") && Player_Controller.m_Movement._Velocity != Vector3.zero)
        {
            Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Running);
        }
        //RUN END
        if (Input.GetButtonUp("Fire3"))
        {
            Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Walking);
        }
        //CROUCH START
        if (Input.GetKeyDown(KeyCode.C))
        {
            if (Player_Controller.MovingState != Player_Controller.MovingStates.Crouching)
            {
                Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Crouching);
            }
            else
            {
                Player_Controller.ChangeMovingState(Player_Controller.MovingStates.Walking);
            }
        }
        #endregion
    }