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.
27 lines
702 B
27 lines
702 B
using Babushka.scripts.CSharp.GameEntity.LoadSave;
|
|
using Godot;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace Babushka.scripts.CSharp.GameEntity.Entities;
|
|
|
|
public partial class PositionalEntity : Entity
|
|
{
|
|
public string sceneName = "none";
|
|
|
|
protected override void SaveEntity(JObject json)
|
|
{
|
|
base.SaveEntity(json);
|
|
json["posx"] = Position.X;
|
|
json["posy"] = Position.Y;
|
|
json["scene"] = sceneName;
|
|
}
|
|
|
|
protected override void LoadEntity(JObject json)
|
|
{
|
|
base.LoadEntity(json);
|
|
Position = new Vector2(
|
|
json.GetFloatValue("posx"),
|
|
json.GetFloatValue("posy"));
|
|
sceneName = json.GetStringValue("scene");
|
|
}
|
|
} |