Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
        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++;
        }