🚚 Rename project
This commit is contained in:
@ -1,44 +1,36 @@
|
||||
using Godot;
|
||||
|
||||
namespace CodingLand.Scripts.Logic;
|
||||
namespace AceField.Scripts.Logic;
|
||||
|
||||
public partial class PlayerInput : MultiplayerSynchronizer
|
||||
{
|
||||
[Export] public bool IsDashing;
|
||||
[Export] public bool IsDashing;
|
||||
|
||||
[Export] public Vector2 BuildingAt;
|
||||
[Export] public Vector2 MovementDirection;
|
||||
|
||||
[Export] public Vector2 MovementDirection;
|
||||
private bool IsCurrentPlayer => GetMultiplayerAuthority() == Multiplayer.GetUniqueId();
|
||||
|
||||
private bool IsCurrentPlayer => GetMultiplayerAuthority() == Multiplayer.GetUniqueId();
|
||||
public override void _Ready()
|
||||
{
|
||||
if (IsCurrentPlayer) return;
|
||||
SetProcess(false);
|
||||
SetPhysicsProcess(false);
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (IsCurrentPlayer) return;
|
||||
SetProcess(false);
|
||||
SetPhysicsProcess(false);
|
||||
}
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Dash()
|
||||
=> IsDashing = true;
|
||||
|
||||
[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");
|
||||
|
||||
[Rpc(CallLocal = true)]
|
||||
private void Build(Vector2 pos)
|
||||
=> BuildingAt = pos;
|
||||
if (Input.IsActionJustPressed("move_dash"))
|
||||
Rpc(nameof(Dash));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent evt)
|
||||
{
|
||||
if (!IsCurrentPlayer) return;
|
||||
if (evt is InputEventMouseButton { Pressed: true })
|
||||
Rpc(nameof(Build), GetViewport().GetMousePosition());
|
||||
}
|
||||
}
|
||||
public override void _Input(InputEvent evt)
|
||||
{
|
||||
if (!IsCurrentPlayer) return;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Godot;
|
||||
using Vector2 = Godot.Vector2;
|
||||
|
||||
namespace CodingLand.Scripts.Logic;
|
||||
namespace AceField.Scripts.Logic;
|
||||
|
||||
public partial class World : Node2D
|
||||
{
|
||||
@ -47,7 +46,7 @@ public partial class World : Node2D
|
||||
|
||||
private void AddPlayer(int id)
|
||||
{
|
||||
var player = PlayerScene.Instantiate<Player>();
|
||||
var player = PlayerScene.Instantiate<AceField.Scripts.Player>();
|
||||
player.SetPlayerId(id);
|
||||
var position = Vector2.FromAngle(GD.Randf() * 2 * Mathf.Pi);
|
||||
player.Position = new Vector2(position.X * 5f * GD.Randf(), position.Y * 5f * GD.Randf());
|
||||
|
Reference in New Issue
Block a user