Files
Babushka/scripts/CSharp/GameEntity/Entities/Entity.cs
T

27 lines
532 B
C#
Raw Normal View History

using System;
2025-12-18 14:27:27 +01:00
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class Entity
2025-12-18 14:27:27 +01:00
{
public long id;
public virtual string EntityType => "";
public Entity()
{
id = new Random().NextInt64();
}
2025-12-18 14:27:27 +01:00
2026-02-03 17:30:35 +01:00
public virtual void SaveEntity(JObject json)
2025-12-18 14:27:27 +01:00
{
json["id"] = id;
json["type"] = EntityType;
2025-12-18 14:27:27 +01:00
}
2026-02-03 17:30:35 +01:00
public virtual void LoadEntity(JObject json)
2025-12-18 14:27:27 +01:00
{
id = json.GetLongValue("id");
2025-12-18 14:27:27 +01:00
}
}