35 lines
794 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|