Ejemplo n.º 1
0
    private void UpdateVerticalVelocity()
    {
        if (!groundCheck.IsGrounded)
        {
            return;
        }

        if (SBInputManager.GetKeyDown(jumpKey))
        {
            rb.velocity = Vector2.up * mvSettings.springAbility;
            SoundManager.PlaySound(Sound.Jump);
        }
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;

            DontDestroyOnLoad(this);
        }

        InitMyKeys();
    }
Ejemplo n.º 3
0
    private void UpdateHorizontalVelocity()
    {
        var horizontalInput = SBInputManager.GetPlayerInput(player.PlayerID);

        if (horizontalInput == 0)
        {
            rb.velocity = new Vector2(0, rb.velocity.y);
            return;
        }

        FlipCharacter(horizontalInput);

        var speed = mvSettings.speed;

        if (player.PowerUpsManager.HasPowerUp(PowerUpType.Boots))
        {
            speed = mvSettings.poweredUpSpeed;
        }

        rb.AddForce(Vector2.right * speed * horizontalInput);

        ClampVelocity();
    }