/// <summary> /// Adds a dynamic entity to the proper cell /// </summary> /// <param name="entity"></param> public void AddEntity(Entity.Entity entity) { entity.SetPartitionCell(PositionToCell(entity).X, PositionToCell(entity).Y); entity.SetCellIndex(PositionToIndex(entity)); dynamicCells[PositionToIndex(entity)].AddEntity(entity); //Console.WriteLine("Added dynamic entity of type " + entity.GetType()); }
// adds entity to appropriate static cell public void AddStaticEntity(Entity.Entity entity) { entity.SetPartitionCell(PositionToCell(entity).X, PositionToCell(entity).Y); entity.SetCellIndex(PositionToIndex(entity)); staticCells[entity.cellIndex].AddEntity(entity); }