Table of Contents

Class TileInstance

Namespace
TinyLife.World
Assembly
TinyLife.dll

A tile instance is a non-single-instance version of a Tile that is placed on a Map at a specific position and floor. Tile instances are serializable and can store additional data on a map to disk using the DataMemberAttribute.

[DataContract]
public class TileInstance : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
TileInstance
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

TileInstance(Tile, Map, Point, int)

Creates a new tile instance with the given settings.

public TileInstance(Tile tile, Map map, Point position, int floor)

Parameters

tile Tile

The underlying tile.

map Map

The map that this tile instance is on.

position Point

The position of this tile instance on the map, in tile coordinates.

floor int

The floor that this tile instance is on.

Fields

Tile

The underlying tile.

[DataMember]
public readonly Tile Tile

Field Value

Tile

Properties

Floor

The floor that this tile instance is on.

public int Floor { get; }

Property Value

int

Map

The map that this tile instance is on.

public Map Map { get; }

Property Value

Map

Position

The position of this tile instance on the map, in tile coordinates.

public Point Position { get; }

Property Value

Point

Methods

GetVariationTexture(Direction2)

Returns a random variation texture (based on this tile instance's Position and Floor) based on the variation textures that this tile instance's Tile supplies through Regions.

public virtual Point GetVariationTexture(Direction2 direction)

Parameters

direction Direction2

The camera rotation.

Returns

Point

The variation texture location.

Validate(Map, Point, int)

Validates this tile instance when loading the game. By default, this method always returns true after setting the Map, Position, and Floor properties.

public virtual bool Validate(Map map, Point position, int floor)

Parameters

map Map

The map that this tile instance is on.

position Point

The position of this tile instance on the map, in tile coordinates.

floor int

The floor that this tile instance is on.

Returns

bool

Whether the tile is valid. If this is false, the tile is replaced by a new instance or by a grass tile.