Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (GameManager.instance.gameState == GameManager.GameState.Playing)
        {
            playerInput.Tick();

            Vector2 movement = playerInput.GetMovement();

            Vector2?aim = playerInput.GetAim();
            _movementVelocity = movement * MOVEMENT_SPEED;

            playerAnimation.SetPlayerRun(_movementVelocity.magnitude > 0.01f);

            if (playerInput.GetSwing())
            {
                playerBat.SwingBat();
                Instantiate(batSoundSwoosh, transform.position, Quaternion.identity);
            }
            playerBat.Tick(aim);
        }
    }