Characters
This commit is contained in:
34
Game/Scripts/Networking/NetworkCharacterInputProxy.cs
Normal file
34
Game/Scripts/Networking/NetworkCharacterInputProxy.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user