public void ReplaceMapEditorTileBrush(Tile newTileType, MapEditor.BrushAction newAction, int newSpawnpointIndex) { var index = TileComponentsLookup.MapEditorTileBrush; var component = CreateComponent <MapEditor.TileBrushComponent>(index); component.TileType = newTileType; component.Action = newAction; component.SpawnpointIndex = newSpawnpointIndex; ReplaceComponent(index, component); }
public TileEntity SetMapEditorTileBrush(Tile newTileType, MapEditor.BrushAction newAction, int newSpawnpointIndex) { if (hasMapEditorTileBrush) { throw new Entitas.EntitasException("Could not set MapEditorTileBrush!\n" + this + " already has an entity with MapEditor.TileBrushComponent!", "You should check if the context already has a mapEditorTileBrushEntity before setting it or use context.ReplaceMapEditorTileBrush()."); } var entity = CreateEntity(); entity.AddMapEditorTileBrush(newTileType, newAction, newSpawnpointIndex); return(entity); }
public void ReplaceMapEditorTileBrush(Tile newTileType, MapEditor.BrushAction newAction, int newSpawnpointIndex) { var entity = mapEditorTileBrushEntity; if (entity == null) { entity = SetMapEditorTileBrush(newTileType, newAction, newSpawnpointIndex); } else { entity.ReplaceMapEditorTileBrush(newTileType, newAction, newSpawnpointIndex); } }