⏪ Rollback place brick feature
This commit is contained in:
@ -5,6 +5,7 @@ namespace AceField.Scripts.Logic;
|
||||
public partial class PlayerInput : MultiplayerSynchronizer
|
||||
{
|
||||
[Export] public bool IsDashing;
|
||||
[Export] public bool IsBuilding;
|
||||
[Export] public bool IsShooting;
|
||||
[Export] public bool IsReloading;
|
||||
|
||||
@ -30,6 +31,10 @@ public partial class PlayerInput : MultiplayerSynchronizer
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Reload()
|
||||
=> IsReloading = true;
|
||||
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Build()
|
||||
=> IsBuilding = true;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
@ -46,5 +51,7 @@ public partial class PlayerInput : MultiplayerSynchronizer
|
||||
public override void _Input(InputEvent evt)
|
||||
{
|
||||
if (!IsCurrentPlayer) return;
|
||||
if (evt is InputEventMouseButton { Pressed: true })
|
||||
Rpc(nameof(Build));
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public partial class World : Node2D
|
||||
}
|
||||
|
||||
private static string BuildPlayerName(int id)
|
||||
=> $"Player#{id}";
|
||||
=> $"Player@{id}";
|
||||
|
||||
private void AddPlayer_Adaptor(long id)
|
||||
=> AddPlayer((int)id);
|
||||
@ -75,4 +75,15 @@ public partial class World : Node2D
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public T GetTileByPosition<T>(Vector2 position) where T : Node2D
|
||||
{
|
||||
foreach (var item in GetChildren())
|
||||
{
|
||||
if (item is T tile && tile.Position == position)
|
||||
return tile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user