Exemplo n.º 1
0
    public void jumpUpdate(bool pressing)
    {
        animations.play("isJumping", !groundCheck.isGrounded());
        jumpTrail();

        if (timeBtwJump > 0 && isJumping && pressing)
        {
            actorRb.velocity = new Vector2(actorRb.velocity.x, -Physics.gravity.y * jumpForce * actorRb.mass);
            timeBtwJump     -= Time.deltaTime;
        }
        else
        {
            isJumping = false;
        }
    }
Exemplo n.º 2
0
    public void moveActor(float side)
    {
        isRunning = side != 0 && groundCheck.isGrounded();

        actorRb.AddForce((Vector2.right * moveForce * actorRb.mass) * side);
        if (Mathf.Abs(actorRb.velocity.x) > maxVelocity)
        {
            actorRb.velocity = new Vector2(maxVelocity * side, actorRb.velocity.y);
        }
        animations.play("isRunning", isRunning);

        flip(side);
        walkSound();
        fakeFriction();
    }