Inventory management focused game written in Godot / C#
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
public partial class Player : CharacterBody3D
|
|
|
|
{
|
|
|
|
[Export] public bool IsLocal { get; set; }
|
|
|
|
|
|
|
|
public int PeerId {
|
|
|
|
get {
|
|
|
|
if (int.TryParse(Name, out var result)) return result;
|
|
|
|
throw new InvalidOperationException($"'{Name}' could not be parsed to PeerId");
|
|
|
|
}
|
|
|
|
set {
|
|
|
|
if (value > 0) Name = value.ToString();
|
|
|
|
else if (IsLocal) Name = "Local";
|
|
|
|
else throw new InvalidOperationException("Non-local player can't have PeerId set to 0");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public MovementController Movement { get; private set; }
|
|
|
|
public CameraController Camera { get; private set; }
|
|
|
|
public AnimationController Animation { get; private set; }
|
|
|
|
public PickupController Pickup { get; private set; }
|
|
|
|
|
|
|
|
public override void _EnterTree()
|
|
|
|
{
|
|
|
|
Movement = GetNode<MovementController>("MovementController");
|
|
|
|
Camera = GetNode<CameraController>("CameraController");
|
|
|
|
Animation = GetNode<AnimationController>("AnimationController");
|
|
|
|
Pickup = GetNode<PickupController>("PickupController");
|
|
|
|
}
|
|
|
|
}
|