This commit is contained in:
2025-05-16 23:31:59 +08:00
parent 9e4fef3f1e
commit d891e3f0ee
1198 changed files with 274242 additions and 1558 deletions

View File

@@ -0,0 +1,36 @@
using UnityEngine.InputSystem;
namespace ECM2.Examples.Jump
{
/// <summary>
/// Extends default Character Input to handle JumpAbility Input.
/// </summary>
public class JumpInput : CharacterInput
{
// The jump ability
private JumpAbility _jumpAbility;
/// <summary>
/// Extend OnJump handler to manage JumpAbility input.
/// </summary>
public override void OnJump(InputAction.CallbackContext context)
{
if (context.started)
_jumpAbility.Jump();
else if (context.canceled)
_jumpAbility.StopJumping();
}
protected override void Awake()
{
base.Awake();
// Cache JumpAbility
_jumpAbility = GetComponent<JumpAbility>();
}
}
}