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; }
private Entity(uint id, EntityClass clazz) { Id = id; Class = clazz; Properties = new List <Property>(); }
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; } }
private Entity(uint id, EntityClass clazz) { Id = id; Class = clazz; Properties = new List<Property>(); }