void HandleAnimation()
    {
        playerAnimation.Movement(charController.velocity.magnitude);
        playerAnimation.PlayerJump(charController.velocity.y);
        if (is_Crouching && charController.velocity.magnitude > 0f)
        {
            playerAnimation.PlayerCrouchWalk(charController.velocity.magnitude);
        }
        //SHotting
        if (Input.GetMouseButtonDown(0) && Time.time > nextTimeToFire)
        {
            nextTimeToFire = Time.time + 1f / fireRate;

            if (is_Crouching)
            {
                playerAnimation.Shoot(false);
            }
            else
            {
                playerAnimation.Shoot(true);
            }

            current_Weapon.Shoot();
            current_Hands_Weapon.Shoot();
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            playerAnimation.ReloadGun();
            current_Hands_Weapon.Reload();
        }
    }
Beispiel #2
0
    void HandleAnimations()
    {
        playerAnimations.Movement(charController.velocity.magnitude);
        playerAnimations.PlayerJump(charController.velocity.y);
        if (is_crouching && charController.velocity.magnitude > 0f)
        {
            playerAnimations.PlayerCrouchWalk(charController.velocity.magnitude);
        }
        //shooting stuffz
        if (isShooting.value == 1)
        {
            if (Input.GetMouseButtonDown(0) && Time.time > nextTimeToFire)
            {
                nextTimeToFire = Time.time + 1f / fireRate;
                if (is_crouching)
                {
                    playerAnimations.Shoot(false);
                }
                else
                {
                    playerAnimations.Shoot(true);
                }

                if (isLocalPlayer)
                {
                    current_Weapon.Shoot();
                    if (isFpsActive)
                    {
                        current_hands_Weapon.Shoot();
                    }
                }
                else
                {
                    current_Weapon.Shoot();
                    if (isFpsActive)
                    {
                        current_hands_Weapon.Shoot();
                    }
                }
            }
        }



        if (Input.GetKeyDown(KeyCode.R))
        {
            playerAnimations.Reload();
            reloadNoification.transform.localScale = Vector3.zero;
            reloadNoification.GetComponent <Animator>().enabled = false;
            isShooting.value = 1;
            if (isFpsActive)
            {
                current_hands_Weapon.Reload();
            }
            PlayerPrefs.SetInt("DEAGLE", 20);
            PlayerPrefs.SetInt("AK47", 20);
            PlayerPrefs.SetInt("M4A1", 20);
        }
    }
    void HandleAnimations()
    {
        playerAnimation.Movement(characterController.velocity.magnitude);
        playerAnimation.PlayerJump(characterController.velocity.y);

        if (is_Crouching && characterController.velocity.magnitude > 0.0f)
        {
            playerAnimation.PlayerCrouchWalk(characterController.velocity.magnitude);
        }
    }