using Babushka.scripts.CSharp.GameEntity.LoadSave; using Godot; using Newtonsoft.Json.Linq; namespace Babushka.scripts.CSharp.GameEntity.Entities; public abstract class PositionalEntity : Entity { private Node2D _positionalNodeRef; public Vector2 position; public string sceneName = "none"; protected override void SaveEntity(JObject json) { base.SaveEntity(json); json["posx"] = _positionalNodeRef.Position.X; json["posy"] = _positionalNodeRef.Position.Y; json["scene"] = sceneName; } protected override void LoadEntity(JObject json) { base.LoadEntity(json); _positionalNodeRef.Position = new Vector2( json.GetFloatValue("posx"), json.GetFloatValue("posy")); sceneName = json.GetStringValue("scene"); } // Deals with Instantiation of the node public abstract void InstantiateEntityNode(Node2D parent); }