Aetheria/Assets/Scripts/ServerShared/Agents/EntityAgent.cs
hyperion51 6aeb2ae280 Entity Persistence Refactoring
Entities refactored to enable robust persistence
Entities detect stale data references and reload behaviors
2020-05-06 04:56:36 +01:00

29 lines
833 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using JsonKnownTypes;
using MessagePack;
using Newtonsoft.Json;
[MessagePackObject,
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<Entity>))]
public class EntityAgent
{
[IgnoreMember] public AgentBehavior CurrentBehavior;
[IgnoreMember] public Guid Entity;
[IgnoreMember] public GameContext Context;
[JsonProperty("homeZone"), Key(0)] public Guid HomeZone;
[JsonProperty("homeColony"), Key(0)] public Guid HomeColony;
public EntityAgent(GameContext context, Guid entity, Guid homeZone, Guid homeColony)
{
Entity = entity;
HomeZone = homeZone;
Context = context;
}
public void Update(float delta)
{
CurrentBehavior?.Update(delta);
}
}