Beispiel #1
0
        public static Entity CreateWith(uint id, EntityClass clazz, FlatTable table)
        {
            var entity = new Entity(id, clazz);

            foreach (var info in table.Properties)
            {
                entity.Properties.Add(Property.For(info));
            }

            return entity;
        }
Beispiel #2
0
        private void Create(uint id, EntityClass clazz, uint baseline)
        {
            state.Created.Add(id);
            if (!state.Slots.ContainsKey(id))
            {
                state.Slots[id] = new DotaGameState.Slot(null);
            }

            var slot = state.Slots[id];
            slot.Live = true;
            if (slot.Baselines[baseline] != null && slot.Baselines[baseline].Class.Equals(clazz))
            {
                slot.Entity = slot.Baselines[baseline].Copy();
            }
            else
            {
                slot.Entity = Entity.CreateWith(id, clazz, state.FlatTables[(int) clazz.Id]);

                var table = state.Strings[state.StringsIndex["instancebaseline"]];
                using (var stream = Bitstream.CreateWith(table.Get(clazz.Id.ToString()).Value))
                {
                    ReadAndUnpackFields(slot.Entity, stream);
                }
            }

            foreach (var prop in slot.Entity.Properties)
            {
                var info = prop.Info;
                var handle = new DotaGameState.PropertyHandle
                {
                    Entity = id,
                    Table = info.Origin.NetTableName,
                    Name = info.VarName
                };
                state.Properties[handle] = prop;
            }

        }
Beispiel #3
0
 private Entity(uint id, EntityClass clazz)
 {
     Id = id;
     Class = clazz;
     Properties = new List<Property>();
 }
Beispiel #4
0
 private Entity(uint id, EntityClass clazz)
 {
     Id         = id;
     Class      = clazz;
     Properties = new List <Property>();
 }