Example #1
0
 public ProtoBuf.AIStateContainer ToProto()
 {
     ProtoBuf.AIStateContainer aIStateContainer = new ProtoBuf.AIStateContainer();
     aIStateContainer.id              = ID;
     aIStateContainer.state           = (int)State;
     aIStateContainer.events          = new List <AIEventData>();
     aIStateContainer.inputMemorySlot = InputMemorySlot;
     foreach (BaseAIEvent @event in Events)
     {
         aIStateContainer.events.Add(@event.ToProto());
     }
     return(aIStateContainer);
 }
Example #2
0
 public void Init(ProtoBuf.AIStateContainer container, BaseEntity owner)
 {
     ID              = container.id;
     State           = (AIState)container.state;
     InputMemorySlot = container.inputMemorySlot;
     Events          = new List <BaseAIEvent>();
     if (container.events == null)
     {
         return;
     }
     foreach (AIEventData @event in container.events)
     {
         BaseAIEvent baseAIEvent = BaseAIEvent.CreateEvent((AIEventType)@event.eventType);
         baseAIEvent.Init(@event, owner);
         baseAIEvent.Reset();
         Events.Add(baseAIEvent);
     }
 }