IsKeyUp.cs 552 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityInput
  3. {
  4. [TaskCategory("Unity/Input")]
  5. [TaskDescription("Returns success when the specified key is released.")]
  6. public class IsKeyUp : Conditional
  7. {
  8. [Tooltip("The key to test")]
  9. public KeyCode key;
  10. public override TaskStatus OnUpdate()
  11. {
  12. return Input.GetKeyUp(key) ? TaskStatus.Success : TaskStatus.Failure;
  13. }
  14. public override void OnReset()
  15. {
  16. key = KeyCode.None;
  17. }
  18. }
  19. }