Beispiel #1
0
        public static Entity ToEntity(this SpawnMsg msg)
        {
            var entity = EntityManager.Instance.CreateEntity(msg.Id);

            Assign(entity, msg);
            return(entity);
        }
Beispiel #2
0
 public static void Assign(this SpawnMsg msg, Entity entity)
 {
     msg.Id   = entity.Id;
     msg.Name = entity.Get <Nameplate>().Name;
     Assign(msg.CharacterResource, entity);
     Assign(msg.UpdatePosition, entity);
 }
Beispiel #3
0
        public static SpawnMsg ToSpawnMsg(this Entity entity)
        {
            var msg = new SpawnMsg();

            Assign(msg, entity);
            return(msg);
        }
Beispiel #4
0
 public static void Assign(this Entity entity, SpawnMsg msg)
 {
     EntityHelper.SetEntityId(entity, msg.Id);
     entity.Get <Nameplate>().Name = msg.Name;
     Assign(entity, msg.CharacterResource);
     Assign(entity, msg.UpdatePosition);
 }
Beispiel #5
0
 public void Spawn(int tilex, int tiley)
 {
     using (var ms = new MemoryStream())
     {
         var msg = new SpawnMsg()
         {
             PlayerIndex = (byte)Index,
             TileX       = tilex,
             TileY       = tiley
         };
         msg.PackFull(ms);
         SendRawData(ms.ToArray());
     }
 }