TileWorldCreator API

TileWorldCreator public methods and properties.

Namespace: TileWorld


worldMap[int _layerIndex].map[int _x, int _y]

The complete generated map is stored in the worldMap property as a multidimensional bool array, the worldMap describes the whole map including all layers. To modify a single cell of a layer you will have to know the layer index(starting at 0) and the exact cell position (x,y)

the value true or false of a cell depends on the invert option in the settings. For example: Adding a cell when invert is set to true then the cell is also set to true. Adding a cell when the invert option is set to false then the cell is also set to false. A great example to see how you can modify a map is the TileWorldCruncher.cs script. Here you can see how the map is modified and rebuilded at runtime.

int mapIndex;

variable of the current selected layer.

Generate(bool _merge);

Generate and build a new map from scratch. Set merge true if the map should be merged

GenerateMaps();

Generate a new map from scratch without building it. Use BuildMapComplete(); to build the generated map.

BuildMapComplete(bool _coroutine, bool _merge, bool _optimize);

Build the generated map.

_coroutine : use coroutine to build the map.
_merge : merge map after building.
_optimize: optimize map before building it.


BuildMapPartial(bool _coroutine, bool _optimize, int _xPos, int _yPos);

Only rebuild a part of the map from the x and y position

_coroutine : use coroutine to build the map.
_optimize: optimize map before building it.
_xPos : x position.
_yPos : y position.


OptimizePassPartial(int _mapIndex, int _x, int _y);

Does an optimization pass only in a certain area from x and y position.

_mapIndex : layer index.
_x : x position.
_y : y position.


AddTiles(Vector3 _position, int _range, bool _heightDependent, bool _rebuild, bool _optimize);

Add new tiles to the given position in a certain range

set heighDependent = true if you want to make sure to add tiles only on the layer with the same height.
set rebuild = true if you want to rebuild the map after modifying it.
set optimize = true if you wish to optimize the map before building it.(makes sure there are no strange build behaviours)

RemoveTiles(Vector3 _position, int _range, bool _heightDependent, bool _rebuild, bool _optimize);

Remove tiles from the given position in a certain range

set heighDependent = true if you want to make sure to remove tiles only on the layer with the same height.
set rebuild = true if you want to rebuild the map after modifying it.
set optimize = true if you wish to optimize the map before building it.(makes sure there are no strange build behaviours)

TileWorldCreator editor methods

FillLayerBlock();

Editor method. Fill the current layer.

FillLayerFloor();

Editor method. Clear the current layer.

AddNewLayer(bool _addNewLayerFromEdit, bool _useMask, int _selectedMask, bool _duplicate, int _duplicateFromIndex);

Editor method. Adds a new layer.

RemoveLayer(int _index);

Editor method. Remove layer.

AddNewMask(int _layerIndex);

Editor method. Add a new mask to a layer

ClearSettings();

Editor method. Clears all settings from TileWorldCreator.

CopyMapFromLayer();

Editor method. Copy map from selected layer.

PasteMapToLayer();

Editor method. Paste copied map to selected layer.

Copyright © doorfortyfour 2015