예제 #1
0
    private void handleMovement(float xspeed)
    {
        //0.2 instead 0 because character would run
        //falling animation on the uneven surfaces
        if (PlayerRigidBody.velocity.y < -4.5)
        {
            CharacterAnimator.SetBool("land", true);
        }
        if (!Attack && !Shoot && !Dodge)
        {
            PlayerRigidBody.velocity = new Vector2(runSpeed * movingDirection, PlayerRigidBody.velocity.y);
        }
        if (Jump && OnGround)
        {
            PlayerRigidBody.AddForce(new Vector2(0, jumpForce));
        }

        CharacterAnimator.SetFloat("speed", Mathf.Abs(movingDirection));
    }
예제 #2
0
    // Movement Function
    private void movementHandler(float horizontal)
    {
        if (this.inScene == true)
        {
            if (PlayerRigidBody.velocity.y < 0)
            {
                playerAnimator.SetBool("land", true);
            }

            if (onGround)
            {
                PlayerRigidBody.velocity = new Vector2(horizontal * speed, PlayerRigidBody.velocity.y);       // x-axis movement
            }

            if (Jump && PlayerRigidBody.velocity.y == 0)
            {
                PlayerRigidBody.AddForce(new Vector2(0, jumpForce));         // Jumping Condition
            }
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     play = GameObject.FindGameObjectWithTag("Player Origin").GetComponentInChildren <PlayerRigidBody>();
 }
 // Start is called before the first frame update
 void Start()
 {
     playerScript = GameObject.FindGameObjectWithTag("Player Origin").GetComponentInChildren <PlayerRigidBody>();
     activated    = false;
     warp7.SetActive(false);
 }
예제 #5
0
 public override void Interact()
 {
     PlayerRigidBody.velocity = Vector2.zero;
     PlayerRigidBody.AddForce(new Vector2(0, JumpForce));
 }