Files
megakoop/Game/Scripts/Networking/NetworkCharacterInputProxy.cs
2025-10-05 18:21:16 +02:00

35 lines
794 B
C#

using UnityEngine;
namespace MegaKoop.Game.Networking
{
public class NetworkCharacterInputProxy : MonoBehaviour, ICharacterInputSource
{
public Vector2 MoveInput { get; private set; }
public bool JumpPressed { get; private set; }
private bool jumpConsumed;
public void SetInput(Vector2 move, bool jump)
{
MoveInput = move;
if (jump)
{
JumpPressed = true;
jumpConsumed = false;
}
}
private void LateUpdate()
{
if (JumpPressed && !jumpConsumed)
{
jumpConsumed = true;
}
else if (jumpConsumed)
{
JumpPressed = false;
}
}
}
}