RB.MapDataGet< T >
Method - Static
public static T MapDataGet< T >(int layer, Vector2i tilePos)
|
Parameters
layer
|
int
|
Tilemap layer
|
tilePos
|
Vector2i
|
Tile position
|
Returns
T
Data
DescriptionGet user tile data at the given layer and tilePos, which was previously set with RB.MapDataSet<T>. Exampleconst int LAYER_TERRAIN = 0;
void Initialize() { int width = 16; int height = 16;
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) { blocking = Random.Range(0, 2) == 0 ? false : true;
RB.MapDataSet<bool>(LAYER_TERRAIN, new Vector2i(x, y), blocking); } } }
void Update() { bool blocking = RB.MapDataGet<bool>(LAYER_TERRAIN, playerTilePos);
if (blocking) { KillPlayer(); } } |
See AlsoRB.MapDataGet<T> RB.MapLayerSpriteSheetSetSee DocsFeatures - Tilemaps Features - Setting or Getting Tile Info |