public void ReplaceTileFactory(svanderweele.Mine.Game.Factories.Tile.ITileFactory newFactory) { var index = FactoryComponentsLookup.TileFactory; var component = CreateComponent <svanderweele.Mine.Game.Factories.Tile.TileFactoryComponent>(index); component.factory = newFactory; ReplaceComponent(index, component); }
public FactoryEntity SetTileFactory(svanderweele.Mine.Game.Factories.Tile.ITileFactory newFactory) { if (hasTileFactory) { throw new Entitas.EntitasException("Could not set TileFactory!\n" + this + " already has an entity with svanderweele.Mine.Game.Factories.Tile.TileFactoryComponent!", "You should check if the context already has a tileFactoryEntity before setting it or use context.ReplaceTileFactory()."); } var entity = CreateEntity(); entity.AddTileFactory(newFactory); return(entity); }
public void ReplaceTileFactory(svanderweele.Mine.Game.Factories.Tile.ITileFactory newFactory) { var entity = tileFactoryEntity; if (entity == null) { entity = SetTileFactory(newFactory); } else { entity.ReplaceTileFactory(newFactory); } }