imperfect-space/scripts/GameObjects/Character.cs

22 lines
501 B
C#

using Godot;
public class Character(Sector sector, Vector3 localCoordinates) : GameObject(sector, localCoordinates)
{
private Player player;
public Player InstantiatePlayer()
{
PackedScene prefab = ResourceLoader.Load<PackedScene>("res://prefabs/gameObjects/player.tscn");
Player instance = prefab.Instantiate<Player>();
instance.PlayerData = this;
player = instance;
return instance;
}
public override void UpdateNodePosition()
{
player.GlobalPosition = LocalCoordinates;
}
}