-
Notifications
You must be signed in to change notification settings - Fork 2
DS_Tile
Base class for all the tile objects.
DS_Tile is the base tile class for the tool/plugin Duniya Skapare. The DS_Tile contains the visual data for the tile. Basically it contains the data where it tells the tile what type of 3D model to load, what it's rotation should be etc.
Type | Name | Defaul Value |
---|---|---|
int | _ROT_EDGE_SIZE | 4 |
Quaternion | _QUAT_0 | |
Quaternion | _QUAT_90 | |
Quaternion | _QUAT_180 | |
Quaternion | _QUAT_270 | |
int | _tile_type | -1 |
DS_Tile[] | _data_edges | |
int | _rot_value | 0 |
bool | _is_fixed | false |
bool | _is_fixed_actual | false |
int | _x | 0 |
int | _y | 0 |
int | _z | 0 |
int | _index | -1 |
int _ROT_EDGE_SIZE = 4
The maximum edge size for rotation. It has a constant value of 4
because for now the tiles are only rotated on the y axis 4 times which are 0, 90, 180 and 270 clockwise.
Quaternion _QUAT_0
A constant quaternion with a y axis rotation of 0
degrees. This constant is needed for sending back the correct rotational value when setting up the tile models.
Quaternion _QUAT_90
A constant quaternion with a y axis rotation of 90
degrees. This constant is needed for sending back the correct rotational value when setting up the tile models.
Quaternion _QUAT_180
A constant quaternion with a y axis rotation of 180
degrees. This constant is needed for sending back the correct rotational value when setting up the tile models.
Quaternion _QUAT_270
A constant quaternion with a y axis rotation of 270
degrees. This constant is needed for sending back the correct rotational value when setting up the tile models.
int _tile_type = -1
The tile type of the tile object. Default is -1
which means the tile has NOT been set.
DS_Tile[] _data_edges
An array of tiles that contains the linked neighbouring tiles. For now a DS_Tile will have a maximum neighbour of 6 which means _data_edges
array size of 6.
_data_edges[0]
is UP neighbour.
_data_edges[1]
is NORTH neighbour.
_data_edges[2]
is EAST neighbour.
_data_edges[3]
is BOTTOM neighbour.
_data_edges[4]
is SOUTH neighbour.
_data_edges[5]
is WEST neighbour.
int _rot_value = 0
The rotational value of the tile which is the DS_Tile's rotation. For now the range of _rot_value
is from 0 to 3.
When _rot_value
is 0 it means 0 degrees.
When _rot_value
is 1 it means 90 degrees.
When _rot_value
is 2 it means 180 degrees.
When _rot_value
is 3 it means 270 degrees.
bool _is_fixed = false
This flag permanently locks the tile to its given information/data which means the tile type, rotation etc are fixed and can NOT be changed. The _is_fixed
flag makes sure that the tile's data are NOT overwritten and preserves them. When _is_fixed
is true
it means the DS_Tile is locked, false
otherwise.
bool _is_fixed_actual = false
This flag temporarily locks the tile to its given information/data which means the tile type, rotation etc are temporarily fixed. This allows certain tiles NOT to be changed at certain points if needed. When _is_fixed_actual
is true
it means the DS_Tile is locked, false
otherwise.
int _x = 0
The x coordinate value.
int _y = 0
The y coordinate value.
int _z = 0
The z coordinate value.
int _index = -1
This is the index of the tile. The index is set by DS_BaseGrid. It is recommended NOT to set the index of the tile by the user.
This method resets the necessary values required for the generator to work with certain data again.
Note: For now _is_fixed is NOT resetted when calling this method.
This method does a hard reset which will reset all the values to its default state.
Note: This method MUST NOT be called during the generator processing otherwise will give wrong results. Call this method ONLY if you want to disregard the given information/data for generating the stage world.
void set_index ( int index )
This method sets the index of the tile. It is recommended NOT to set the index of the tile manually or by the user.
int get_index ()
This method returns the index of the tile.
void set_is_fixed ( bool is_fix )
This method sets if the tile should be fixed or NOT, meaning if the tile should be locked. This will set both the _is_fixed and _is_fixed_actual properties to the given parameter is_fix
. When is_fix
is true
the tile will be fixed/locked permanently, false
otherwise.
Note: Make sure the tile type is set manually if the tile is fixed/locked otherwise the generator will NOT be able to set the tile type because the tile will be permanently locked/fixed.
bool is_fixed ()
This method checks if the tile is permanently fixed or NOT. It checks the flag status of the property _is_fixed. True
means the tile is permanently locked, false
otherwise.
void set_is_fixed_actual ( bool is_fix_actual )
This method sets if the tils should be temporarily fixed or NOT, meaning if the tilw should be temporarily locked. This will set _is_fixed_actual property to the given parameter is_fix_actual
. When is_fix_actual
is true
the tile will be temporarily fixed/locked, false
otherwise.
bool is_fixed_actual ()
This method checks if the tile is temporarily fixed/locked or NOT. It checks the flag status of the property _is_fixed_actual. True
means the tile is temporarily locked, false
otherwise.
void set_tile_type ( int tile_type )
This method sets the tile type property _tile_type to the given tile_type
parameter.
int get_tile_type ()
This method gets the _tile_type value of the tile.
This method sets the linked/neighbour tile index
to the given tile
parameter.
When index
is 0 then UP
linked/neighbour/edge tile will be set.
When index
is 1 then NORTH
linked/neighbour/edge tile will be set.
When index
is 2 then EAST
linked/neighbour/edge tile will be set.
When index
is 3 then BOTTOM
linked/neighbour/edge tile will be set.
When index
is 4 then SOUTH
linked/neighbour/edge tile will be set.
When index
is 5 then WEST
linked/neighbour/edge tile will be set.
Note: If the linked/neighbour/edge tile is null then a Null Pointer
exception will be thrown.
This method gets the index
linked/neighbour/edge tile.
When index
is 0 then UP
linked/neighbour/edge tile will be returned.
When index
is 1 then NORTH
linked/neighbour/edge tile will be returned.
When index
is 2 then EAST
linked/neighbour/edge tile will be returned.
When index
is 3 then BOTTOM
linked/neighbour/edge tile will be returned.
When index
is 4 then SOUTH
linked/neighbour/edge tile will be returned.
When index
is 5 then WEST
linked/neighbour/edge tile will be returned.
This method get the linked/neighbour/edge index
tile after rotating the current tile. This is because after rotating the tile the NORTH
, EAST
, SOUTH
and WEST
neighbours edges' changes. This method then gets the actual edge tile.
For example, when the tile is NOT rotated then the NORTH
neighbour is in index 1
, EAST
neighbour is in index 2
, SOUTH
neighbour is in index 4
and WEST
neighbour is in index 5
. After rotating the tile once that is rotating the tile 90
degrees then the NORTH
neighbour has been shifted to the index 2
, EAST
neighbour has been shifted to index 4
, SOUTH
neighbour has been shifted to index 5
and WEST
neighbour has been shifted to index 1
.
int get_edge_size ()
This method gets the number of linked/neighbour/edge tiles that can be stored. At the moment the size is 6 because the edges available are UP
, NORTH
, EAST
, BOTTOM
, SOUTH
and WEST
.
void set_up ( DS_Tile up )
This method sets the UP
linked/neighbour/edge tile with the given up
parameter.
DS_Tile get_up ()
This method returns the UP
linked/neighbour/edge tile which is _data_edges[0]
.
void set_north ( DS_Tile north )
This method sets the NORTH
linked/neighbour/edge tile with the given north
parameter.
DS_Tile get_north ()
This method returns the NORTH
linked/neighbour/edge tile which is _data_edges[1]
.
void set_east ( DS_Tile east )
This method sets the EAST
linked/neighbour/edge tile with the given east
parameter.
DS_Tile get_east ()
This method returns the EAST
linked/neighbour/edge tile which is _data_edges[2]
.
void set_bottom ( DS_Tile bottom )
This method sets the BOTTOM
linked/neighbour/edge tile with the given bottom
parameter.
DS_Tile get_bottom ()
This method returns the BOTTOM
linked/neighbour/edge tile which is _data_edges[3]
.
void set_south ( DS_Tile south )
This method sets the SOUTH
linked/neighbour/edge tile with the given south
parameter.
DS_Tile get_south ()
This method returns the SOUTH
linked/neighbour/edge tile which is _data_edges[4]
.
void set_west ( DS_Tile west )
This method sets the WEST
linked/neighbour/edge tile with the given west
parameter.
DS_Tile get_west ()
This method returns the WEST
linked/neighbour/edge tile which is _data_edges[5]
.
Quaternion get_tile_rotation_quat ()
This method gets the Quaternion rotation of the tile.
float get_tile_rotation_radian ()
This method gets radian rotation of the tile.
float get_tile_rotation_degree ()
This method gets the rotation degree of the tile.
float get_tile_rotation ()
This method gets the rotation of the tile in degrees. Call this method for debugging ONLY. It is recommended to call the get_tile_rotation_quat() which is best for rotating tiles or get_tile_rotation_radian() and get_tile_rotation_degree() which are the second best option.
Note: Using this method for 3D model rotation will give weird results. Please call the recommended methods as mentioned.
void set_tile_rotation_value ( int rot_value )
This method sets the rotation value _rot_value with the given rot_value
parameter. The range of rot_value
should be from 0 to _ROT_EDGE_SIZE.
int get_tile_rotation_value ()
This method gets the rotation value _rot_value of the tile.
This method gets the correct linked/neighbour/edge tile's index
after rotating the current tile.
For example, when the tile is NOT rotated then the NORTH
neighbour is in index 1
, EAST
neighbour is in index 2
, SOUTH
neighbour is in index 4
and WEST
neighbour is in index 5
. After rotating the tile once that is rotating the tile 90
degrees then the NORTH
neighbour has been shifted to the index 2
, EAST
neighbour has been shifted to index 4
, SOUTH
neighbour has been shifted to index 5
and WEST
neighbour has been shifted to index 1
.
This method sets the coordinate of the tile with the given x
, y
and z
value.
int get_x ()
This method returns the _x coordinate of the tile.
int get_y ()
This method returns the _y coordinate of the tile.
int get_z ()
This method returns the _z coordinate of the tile.
This method checks if the given tile
coordinate matches with the current tile's coordinate. True
means the tile matches, false
otherwise.
This method checks if the given coordinates x
, y
and z
matches with the current tile's coordinate. True
means the tile matches, false
otherwise.
TOOLS
CLASS REFERENCE
- Generators
-
- Wave Function Collapse
- Grids
- Tiles