|
|
|
public partial class Player : CharacterBody3D
|
|
|
|
{
|
|
|
|
/// <summary> Returns whether is the local player. </summary>
|
|
|
|
public bool IsLocal => this.IsAuthority();
|
|
|
|
|
|
|
|
/// <summary> Gets the peer ID of this player. </summary>
|
|
|
|
public int PeerId => GetMultiplayerAuthority();
|
|
|
|
|
|
|
|
/// <summary> Gets the workshop owned by this player. </summary>
|
|
|
|
public Workshop OwnedWorkshop => Game.Workshops.ByPeerId(PeerId);
|
|
|
|
|
|
|
|
/// <summary> Gets the workshop the player is physically in, if any. </summary>
|
|
|
|
public Workshop EnteredWorkshop { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
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>(nameof(MovementController));
|
|
|
|
Camera = GetNode<CameraController>(nameof(CameraController));
|
|
|
|
Animation = GetNode<AnimationController>(nameof(AnimationController));
|
|
|
|
Pickup = GetNode<PickupController>(nameof(PickupController));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnWorkshopTrackerAreaEntered(Area3D area)
|
|
|
|
{
|
|
|
|
if (area is Workshop workshop)
|
|
|
|
EnteredWorkshop = workshop;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnWorkshopTrackerAreaExited(Area3D area)
|
|
|
|
{
|
|
|
|
if (area is Workshop)
|
|
|
|
EnteredWorkshop = null;
|
|
|
|
}
|
|
|
|
}
|