✨ Reload & HUD
This commit is contained in:
@ -6,6 +6,7 @@ public partial class PlayerInput : MultiplayerSynchronizer
|
||||
{
|
||||
[Export] public bool IsDashing;
|
||||
[Export] public bool IsShooting;
|
||||
[Export] public bool IsReloading;
|
||||
|
||||
[Export] public Vector2 MovementDirection;
|
||||
|
||||
@ -25,6 +26,10 @@ public partial class PlayerInput : MultiplayerSynchronizer
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Shoot()
|
||||
=> IsShooting = true;
|
||||
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Reload()
|
||||
=> IsReloading = true;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
@ -32,8 +37,10 @@ public partial class PlayerInput : MultiplayerSynchronizer
|
||||
|
||||
if (Input.IsActionJustPressed("move_dash"))
|
||||
Rpc(nameof(Dash));
|
||||
if (Input.IsActionJustPressed("shoot"))
|
||||
if (Input.IsActionJustPressed("weapon_shoot"))
|
||||
Rpc(nameof(Shoot));
|
||||
if (Input.IsActionJustPressed("weapon_reload"))
|
||||
Rpc(nameof(Reload));
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent evt)
|
||||
|
@ -33,10 +33,8 @@ public partial class World : Node2D
|
||||
Multiplayer.PeerConnected -= AddPlayer_Adaptor;
|
||||
}
|
||||
|
||||
private string BuildPlayerName(int id)
|
||||
{
|
||||
return $"Player#{id}";
|
||||
}
|
||||
private static string BuildPlayerName(int id)
|
||||
=> $"Player#{id}";
|
||||
|
||||
private void AddPlayer_Adaptor(long id)
|
||||
=> AddPlayer((int)id);
|
||||
|
Reference in New Issue
Block a user