Esempio n. 1
0
 // Handles the input of the player. In this case it changes the animation based on the button pressed.
 private void HandleInput()
 {
     if (Input.GetKeyDown(KeyCode.LeftShift))
     {
         MyAnimator.SetTrigger("attack");    // Plays the melee attack animation.
     }
     if (Input.GetKeyDown(KeyCode.LeftControl))
     {
         MyAnimator.SetTrigger("slide");     // plays the slide animation.
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         MyAnimator.SetTrigger("jump");      // Plays the jump animation.
     }
     if (Input.GetKeyDown(KeyCode.V))
     {
         MyAnimator.SetTrigger("throw");     // Plays the throw animation.
     }
     if (Input.GetKeyDown(KeyCode.Return) && !EventScript.IsControllable)
     {
         HandleMovement(EventScript.Speed);          //runs the handlemovemt forcing the player character to move during a scripted event.
         StartCoroutine(EventScript.EventRun());     // calls the IEnumator that handles the timing for the scripted event.
     }
 }