Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //Sets the players current movement speed
        //In the X direction
        horizontal_movement_speed = Input.GetAxisRaw("Horizontal") * horizontal_run_speed;
        //In the Y direction
        vertical_movement_speed = controller.PlayerSpeed();

        //Calls the animator depending on what the current movement speed is
        //In the X direction
        player_animation.SetFloat("PlayerXSpeed", Mathf.Abs(horizontal_movement_speed));
        //In the Y direction
        player_animation.SetFloat("PlayerYSpeed", vertical_movement_speed);

        //Handling Jumping
        if (controller.player_jumpCount > 0 && Input.GetButtonDown("Jump"))
        {
            if (Input.GetKey(KeyCode.S) && controller.player_Grounded)
            {
                CreateThorns();
                controller.ThornJump();
                Invoke("DestroyThorns", 1.15f);
            }
            else
            {
                player_jump = true;
                player_animation.SetTrigger("JumpPressed");
            }
        }
    }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (controller.player_Grounded && Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.S))
     {
         CreateThorns();
         controller.ThornJump();
         Invoke("DestroyThorns", 1.15f);
     }
 }