33 lines
733 B
C#
33 lines
733 B
C#
using Godot;
|
|
|
|
namespace CodingLand.Scripts.Logic;
|
|
|
|
public partial class PlayerInput : MultiplayerSynchronizer
|
|
{
|
|
[Export] public bool IsDashing;
|
|
|
|
[Export] public Vector2 MovementDirection;
|
|
|
|
public override void _Ready()
|
|
{
|
|
if (GetMultiplayerAuthority() != Multiplayer.GetUniqueId())
|
|
{
|
|
SetProcess(false);
|
|
SetPhysicsProcess(false);
|
|
}
|
|
}
|
|
|
|
[Rpc(CallLocal = true)]
|
|
private void Dash()
|
|
{
|
|
IsDashing = true;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
MovementDirection = Input.GetVector("move_left", "move_right", "move_up", "move_down");
|
|
|
|
if (Input.IsActionJustPressed("move_dash"))
|
|
Rpc(nameof(Dash));
|
|
}
|
|
} |