public void AddEntity(Entity.Entity entity) { Entity.Entity tempEntity = entity; tempEntity.components.Remove(entity.GetComponent("PhysicsComponent")); Console.WriteLine(entity.GetComponent("PhysicsComponent")); tempEntity.AddComponent(new PhysicsComponent()); dynamicCellSpacePartition.AddEntity(entity); }
public void LoadEntity(Entity.Entity entity) { Entity.Entity temp = entity; // reseting components temp.components = new List <Component>(); for (int i = 0; i < entity.components.Count; i++) { temp.AddComponent(entity.components[i]); } dynamicCellSpacePartition.LoadEntity(temp); }
public void AddTile(string name, params IEntityComponent[] components) { var id = (MaxId <Tile>() ?? 0) + 1; var entity = new Entity.Entity(new Tile(id, MapSize, name)); foreach (var comp in components) { entity.AddComponent(comp); } Context.Add(entity); MapSize++; }