Beispiel #1
0
    private void UpdateVerticalVelocity()
    {
        if (!groundCheck.IsGrounded)
        {
            return;
        }

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

            DontDestroyOnLoad(this);
        }

        InitMyKeys();
    }
Beispiel #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();
    }