TilePlus Version 5
Unity3D Tilemap Extension
Loading...
Searching...
No Matches
TilePlus.TpTileUtils Class Reference

Some static utility methods for tile math. More...

Public Types

enum  DirectionType4 {
  None , Up , Right , Down ,
  Left
}
 Direction of movement, swipe direction, etc. This is for a 4-way direction type: up,right,down,left. More...
enum  DirectionType8 {
  None , Up , RightUp , Right ,
  RightDown , Down , LeftDown , Left ,
  LeftUp
}
 Direction of movement, swipe direction, etc. This is for a 8-way direction type: up,up-right,right,right-down,down,left-down,left.left-up. More...

Static Public Member Functions

static Matrix4x4 RotatationMatixZ (float angle)
 Get a Matrix4x4 for an angle.
static Matrix4x4 ScaleMatrix (Vector3 scale, Vector3 position)
 Get a Matrix4x4 for scaling.
static Vector3 RoundVector3 (Vector3 input, int digits)
 Round an input Vector3 to n digits.
static void GetTransformComponents (Tilemap map, Vector3Int position, out Vector3 tPosition, out Vector3 tRotation, out Vector3 tScale)
 Get the transform components for a tile. Convenience Function.
static void GetTransformComponents (Matrix4x4 transform, out Vector3 tPosition, out Vector3 tRotation, out Vector3 tScale)
 Get the transform components for a tile from its transform (not the same as a GameObj Transform!). Convenience Function.
static Vector3 GetTransformRotation (Tilemap map, Vector3Int position)
 Get the rotation of a tile's sprite.
static Vector3 GetTransformPosition (Tilemap map, Vector3Int position)
 Get the position of a tile's sprite.
static Vector3 GetTransformScale (Tilemap map, Vector3Int position)
 Get the scale of a tile's sprite.
static Matrix4x4 SetTransform (Tilemap map, Vector3Int position, Vector3 tPosition, Vector3 tRotation, Vector3 tScale)
 Set the transform for a tile. Convenience function.
static Matrix4x4 MakeMatrix2D (Vector3 position, Vector3 rotation, Vector3 scale)
 Convience function to create Matrix 4x4 from position, rotation (Z only), scale, but optimized for tile sprites which don't support Z for position and scale.
static Vector3 GetTileSpriteRotation (TilePlusBase tpb)
 Get a Tile sprite rotation.
static void SetTileSpriteRotation (TilePlusBase tpb, Vector3 value, bool constantScaleAndPosition=true)
 Set a Tile sprite rotation.
static Vector3 GetTileSpritePosition (TilePlusBase tpb)
 Get a Tile sprite position.
static void SetTileSpritePosition (TilePlusBase tpb, Vector3 value, bool constantRotationAndScale=true)
 Set a Tile sprite position.
static Color GetTileSpriteColor (TilePlusBase tpb)
 Get a Tile sprite Color.
static void SetTileSpriteColor (TilePlusBase tpb, Color value)
 Set a Tile sprite color.
static Vector3 GetTileSpriteScale (TilePlusBase tpb)
 Get a Tile sprite scale.
static void SetTileSpriteScale (TilePlusBase tpb, Vector3 value, bool constantPositionAndRotation=true)
 Set a Tile sprite scale.
static BoundsInt CreateBoundsInt (Vector3Int position, Vector3Int size, bool forceZto1=true)
 Create a BoundsInt given a center position and a size.
static BoundsInt BoundsIntFromBounds (Bounds bounds, bool ceiling=true)
 Create BoundsInt from Bounds. Use ceiling or floor.
static Vector3 RandomPosInBounds (Bounds bounds)
 Get a random world position within bounds.
static Bounds BoundsFromOrthoCamera (Camera? camera, bool square=true, float scale=1f, bool zeroZ=true)
 Get a bounds representing the Camera's viewport.
static BoundsInt LargestBoundsInt (IEnumerable< BoundsInt > input)
 Get the largest BoundsInt from a list of BoundsInts.
static DirectionType4 NextDirectionType4 (DirectionType4 d)
 clockwide direction movement for four directions
static Vector3Int[] Get4WayAdjacent (Vector3Int center)
 Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in a 4-way coordinate space. In the same order as DirectionType4 (except for None: Up/Right/Down/Left)
static void Get4WayAdjacentHashSet (Vector3Int center, HashSet< Vector3Int >? hashSet, bool clear=true)
 Get an HashSet of Vector3Int objects with row/col coords adjacent to the provided centerpoint in a 4-way coordinate space.
static DirectionType4 Get4WayRandomDirection ()
 Get a random direction in a 4-way coordinate space.
static void Get4WayPerpendicular (Vector3Int center, DirectionType4 dir, Vector3Int[]? output)
 Get the two locations next to the current location in a perpendicular orientation eg if dir == down or up then the two locations to the right and left of the 'center' are provided. Note: 4 way coordinate space.
static Vector3Int Get4WayNextInOppositeDir (Vector3Int position, DirectionType4 dir)
 Get the grid position that's 'get next in opposite direction' in a 4-way coordinate space.
static DirectionType4 Get4WayOppositeDirectionType (DirectionType4 dir)
 Get the DirectionType4 that's opposite from the input in a 4-way coordinate space.
static Vector3Int Get4WayAdjacent (Vector3Int position, DirectionType4 dir)
 Get adjacent position to input position. Or "get next in same direction" in a 4-way coordinate space.
static DirectionType8 NextDirectionType8 (DirectionType8 d)
 clockwide direction movement for 8 direction coordinate space.
static Vector3Int Get8WayAdjacent (Vector3Int position, DirectionType8 dir)
 Get a Vector3Int with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space.
static Vector3Int[] Get8WayAdjacent (Vector3Int center)
 Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space. Same order as DirectionType8.
static HashSet< Vector3Int > Get8WayAdjacentHashSet (Vector3Int center)
 Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space.
static DirectionType8 GetRandomDirection ()
 Get a random direction.
static void DeleteTilesFromPositionList (Tilemap map, Vector3Int[] positions)
 Helper: Delete all tiles from a list/array of positions.
static void DeleteTilesFromPositionList (Tilemap map, IEnumerable< Vector3Int > positions)
 Helper: Delete all tiles from an IEnumerable of positions.
static void DeleteTilePlusBaseBlock (Tilemap map, IEnumerable< TilePlusBase > tiles)
 Helper: Delete a block of TilePlus tiles.
static float GetOneShotTimeOut (int numSpritesInAnimation, float animationSpeed, Tilemap? map)
 [DEPRECATED in V5] Get a timeout for rewinding a one-shot animation when it completes
static Bounds GetTrueBoundsForTileSprite (Tilemap? map, Vector3Int position)
 Get the true bounds for a Tile's sprite. Takes into account transform scaling.
static Vector2Int GetTileSpriteIntegerSize (Tilemap map, Vector3Int position)
 Get a Vector2Int with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale.
static Vector2 GetTileSpriteSize (Tilemap map, Vector3Int position)
 Get a Vector2 with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale.
static Vector2 GetTileSpriteSize (TilePlusBase tpb)
 Get a Vector2 with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale. Convenience overload.
static RectInt GridPositionsSurrounding (Vector3Int gridPosition)
 Get a RectInt of size 3x3 with the passed gridPostion as the center.
static RectInt RectIntFromBoundsInt (BoundsInt boundsInt, Vector3Int offset)
 Create a RectInt from a BoundsInt. Ignores the BoundsInt Position.
static bool SwapTiles (TilePlusBase a, TilePlusBase b, bool tween=false, TpTweenSpec.Tween? tweenSpec=null, float tweenDuration=0.25f, TpEasingFunction.Ease easeFunction=TpEasingFunction.Ease.Linear, bool debug=false)
 Swap two TilePlus tiles. Optional tweening.

Detailed Description

Some static utility methods for tile math.

Member Enumeration Documentation

◆ DirectionType4

Direction of movement, swipe direction, etc. This is for a 4-way direction type: up,right,down,left.

Enumerator
None 

Default.

Up 

UP.

Right 

RIGHT.

Down 

DOWN.

Left 

LEFT.

◆ DirectionType8

Direction of movement, swipe direction, etc. This is for a 8-way direction type: up,up-right,right,right-down,down,left-down,left.left-up.

Enumerator
None 

Default.

Up 

UP.

RightUp 

Right-up.

Right 

RIGHT.

RightDown 

Right-Down.

Down 

DOWN.

LeftDown 

Left-Down.

Left 

LEFT.

LeftUp 

Left-up.

Member Function Documentation

◆ BoundsFromOrthoCamera()

Bounds TilePlus.TpTileUtils.BoundsFromOrthoCamera ( Camera? camera,
bool square = true,
float scale = 1f,
bool zeroZ = true )
static

Get a bounds representing the Camera's viewport.

Parameters
cameraa Camera
squareNormally TRUE, for use with chunking/layout system. ALWAYS returns a square bounds.
scaleScale the bounds if square is FALSE. Not used when square=true.
zeroZIf square is FALSE and zeroZ is TRUE then the bounds center Z is forced to zero. Default=true.
Returns
bounds, or empty bounds if cam is null or isn't orthographic

◆ BoundsIntFromBounds()

BoundsInt TilePlus.TpTileUtils.BoundsIntFromBounds ( Bounds bounds,
bool ceiling = true )
static

Create BoundsInt from Bounds. Use ceiling or floor.

Parameters
boundsA Bounds
ceilingtrue to use ceiling (round up) or false to use floor (round down) if needed
Returns
A boundsInt based on the size. Pos.z = 0, size.z = 1

Designed for showing positionDb surface: may not work well for other uses.

◆ CreateBoundsInt()

BoundsInt TilePlus.TpTileUtils.CreateBoundsInt ( Vector3Int position,
Vector3Int size,
bool forceZto1 = true )
static

Create a BoundsInt given a center position and a size.

Parameters
positionposition @ CENTER
sizesize
forceZto1default true: force size.z to 1
Returns
BoundsInt

◆ DeleteTilePlusBaseBlock()

void TilePlus.TpTileUtils.DeleteTilePlusBaseBlock ( Tilemap map,
IEnumerable< TilePlusBase > tiles )
static

Helper: Delete a block of TilePlus tiles.

Parameters
mapTilemap to affect
tilesIenumerable of TilePlusBase

For TilepLus tiles only.

◆ DeleteTilesFromPositionList() [1/2]

void TilePlus.TpTileUtils.DeleteTilesFromPositionList ( Tilemap map,
IEnumerable< Vector3Int > positions )
static

Helper: Delete all tiles from an IEnumerable of positions.

Parameters
maptilemap
positionsposition array

For any type of tile

◆ DeleteTilesFromPositionList() [2/2]

void TilePlus.TpTileUtils.DeleteTilesFromPositionList ( Tilemap map,
Vector3Int[] positions )
static

Helper: Delete all tiles from a list/array of positions.

Parameters
maptilemap
positionsposition array

For any type of tile

◆ Get4WayAdjacent() [1/2]

Vector3Int[] TilePlus.TpTileUtils.Get4WayAdjacent ( Vector3Int center)
static

Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in a 4-way coordinate space. In the same order as DirectionType4 (except for None: Up/Right/Down/Left)

Parameters
centerCenterpoint
Returns
array of four Vector3Ints with modified coordinates

◆ Get4WayAdjacent() [2/2]

Vector3Int TilePlus.TpTileUtils.Get4WayAdjacent ( Vector3Int position,
DirectionType4 dir )
static

Get adjacent position to input position. Or "get next in same direction" in a 4-way coordinate space.

Parameters
positioninput grid position
dirdirection to consider
Returns
Adjacent grid position

◆ Get4WayAdjacentHashSet()

void TilePlus.TpTileUtils.Get4WayAdjacentHashSet ( Vector3Int center,
HashSet< Vector3Int >? hashSet,
bool clear = true )
static

Get an HashSet of Vector3Int objects with row/col coords adjacent to the provided centerpoint in a 4-way coordinate space.

Parameters
centerCenterpoint
hashSetHashSet for returned values. order is up,down,right,left
clearclear hashset. Default=true

due to copying of 'center', allocs about 80 bytes

◆ Get4WayNextInOppositeDir()

Vector3Int TilePlus.TpTileUtils.Get4WayNextInOppositeDir ( Vector3Int position,
DirectionType4 dir )
static

Get the grid position that's 'get next in opposite direction' in a 4-way coordinate space.

Parameters
positionA grid position
dirDirection to consider
Returns
grid position of target

◆ Get4WayOppositeDirectionType()

DirectionType4 TilePlus.TpTileUtils.Get4WayOppositeDirectionType ( DirectionType4 dir)
static

Get the DirectionType4 that's opposite from the input in a 4-way coordinate space.

Parameters
dirInput DirectionType4
Returns
Opposite DirectionType4

◆ Get4WayPerpendicular()

void TilePlus.TpTileUtils.Get4WayPerpendicular ( Vector3Int center,
DirectionType4 dir,
Vector3Int ?[] output )
static

Get the two locations next to the current location in a perpendicular orientation eg if dir == down or up then the two locations to the right and left of the 'center' are provided. Note: 4 way coordinate space.

Parameters
centerTarget
dirdirection
outputto Vector3Int[2]

If the length of output is LT 2 then an indexing exception error will be thrown. Declare a private var to avoid allocations.

◆ Get4WayRandomDirection()

DirectionType4 TilePlus.TpTileUtils.Get4WayRandomDirection ( )
static

Get a random direction in a 4-way coordinate space.

Returns
A random DirectionType4. Never includes DirectionType4.None

◆ Get8WayAdjacent() [1/2]

Vector3Int[] TilePlus.TpTileUtils.Get8WayAdjacent ( Vector3Int center)
static

Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space. Same order as DirectionType8.

Parameters
centerCenterpoint
Returns
array of eight Vector3Ints with modified coordinates in the same order as DirectionType8

◆ Get8WayAdjacent() [2/2]

Vector3Int TilePlus.TpTileUtils.Get8WayAdjacent ( Vector3Int position,
DirectionType8 dir )
static

Get a Vector3Int with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space.

Parameters
positionOrigin
dirA value from the DirectionType8 enum
Returns
Vector3Int with modified coordinates

◆ Get8WayAdjacentHashSet()

HashSet< Vector3Int > TilePlus.TpTileUtils.Get8WayAdjacentHashSet ( Vector3Int center)
static

Get an array of Vector3Int objects with row/col coords adjacent to the provided centerpoint in an 8-way coordinate space.

Parameters
centerCenterpoint
Returns
8-position HashSet. Note: allocation

◆ GetOneShotTimeOut()

float TilePlus.TpTileUtils.GetOneShotTimeOut ( int numSpritesInAnimation,
float animationSpeed,
Tilemap? map )
static

[DEPRECATED in V5] Get a timeout for rewinding a one-shot animation when it completes

Parameters
numSpritesInAnimationNumber of sprites being animated
animationSpeedThe animation speed we want to use
mapThe parent Tilemap: used to get the Tilemap's animation speed
Returns
float

◆ GetRandomDirection()

DirectionType8 TilePlus.TpTileUtils.GetRandomDirection ( )
static

Get a random direction.

Returns
A random DirectionType4. Never includes DirectionType4.None

◆ GetTileSpriteColor()

Color TilePlus.TpTileUtils.GetTileSpriteColor ( TilePlusBase tpb)
static

Get a Tile sprite Color.

Parameters
tpbtile instance
Returns
Sprite's Color. White if tile instance passed-in is null.

◆ GetTileSpriteIntegerSize()

Vector2Int TilePlus.TpTileUtils.GetTileSpriteIntegerSize ( Tilemap map,
Vector3Int position )
static

Get a Vector2Int with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale.

Parameters
mapTilemap
positionposition
Returns
V2I with sprite size rounded up. If sprite is null, returns Vector2Int.one

◆ GetTileSpritePosition()

Vector3 TilePlus.TpTileUtils.GetTileSpritePosition ( TilePlusBase tpb)
static

Get a Tile sprite position.

Parameters
tpbtile instance
Returns
Sprite's position as Vector3. V3.0 if tile instance passed-in is null.

◆ GetTileSpriteRotation()

Vector3 TilePlus.TpTileUtils.GetTileSpriteRotation ( TilePlusBase tpb)
static

Get a Tile sprite rotation.

Parameters
tpbtile instance
Returns
Sprite's rotation as Vector3. V3.0 if tile instance passed-in is null.

◆ GetTileSpriteScale()

Vector3 TilePlus.TpTileUtils.GetTileSpriteScale ( TilePlusBase tpb)
static

Get a Tile sprite scale.

Parameters
tpbtile instance
Returns
Sprite's scale as Vector3. V3.0 if tile instance passed-in is null.

◆ GetTileSpriteSize() [1/2]

Vector2 TilePlus.TpTileUtils.GetTileSpriteSize ( Tilemap map,
Vector3Int position )
static

Get a Vector2 with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale.

Parameters
mapTilemap
positionposition
Returns
V2. If sprite is null, returns Vector2.one

◆ GetTileSpriteSize() [2/2]

Vector2 TilePlus.TpTileUtils.GetTileSpriteSize ( TilePlusBase tpb)
static

Get a Vector2 with the TRUE size of a tile's sprite; ie, including any effect of the tile's transform scale. Convenience overload.

Parameters
tpbTilePlusBase instance
Returns
V2. If sprite is null or parent tilemap is null, returns Vector2.one

◆ GetTransformComponents() [1/2]

void TilePlus.TpTileUtils.GetTransformComponents ( Matrix4x4 transform,
out Vector3 tPosition,
out Vector3 tRotation,
out Vector3 tScale )
static

Get the transform components for a tile from its transform (not the same as a GameObj Transform!). Convenience Function.

Parameters
transforma Tilemap sprite transform.
tPositiontransform's position placed here
tRotationtransform's rotation placed here
tScaletransform's scale placed here

Handy for tweening the transform (pos,scale,rot) of a tile

No checking for whether or not a tile exists at that position

◆ GetTransformComponents() [2/2]

void TilePlus.TpTileUtils.GetTransformComponents ( Tilemap map,
Vector3Int position,
out Vector3 tPosition,
out Vector3 tRotation,
out Vector3 tScale )
static

Get the transform components for a tile. Convenience Function.

Parameters
mapTilemap
positionposition on map
tPositiontransform's position placed here
tRotationtransform's rotation placed here
tScaletransform's scale placed here

Handy for tweening the transform (pos,scale,rot) of a tile

No checking for whether or not a tile exists at that position

◆ GetTransformPosition()

Vector3 TilePlus.TpTileUtils.GetTransformPosition ( Tilemap map,
Vector3Int position )
static

Get the position of a tile's sprite.

Parameters
mapthe tilemap
positionposition of tile
Returns
the position of the sprite

◆ GetTransformRotation()

Vector3 TilePlus.TpTileUtils.GetTransformRotation ( Tilemap map,
Vector3Int position )
static

Get the rotation of a tile's sprite.

Parameters
mapThe tilemap
positionthe position of the tile
Returns
the rotation of the sprite

◆ GetTransformScale()

Vector3 TilePlus.TpTileUtils.GetTransformScale ( Tilemap map,
Vector3Int position )
static

Get the scale of a tile's sprite.

Parameters
mapthe tilemap
positionposition of tile
Returns
the scale of the sprite

◆ GetTrueBoundsForTileSprite()

Bounds TilePlus.TpTileUtils.GetTrueBoundsForTileSprite ( Tilemap? map,
Vector3Int position )
static

Get the true bounds for a Tile's sprite. Takes into account transform scaling.

Parameters
mapSource tilemap
positionposition
Returns
Bounds for sprite. If map==null returns an empty Bounds

◆ GridPositionsSurrounding()

RectInt TilePlus.TpTileUtils.GridPositionsSurrounding ( Vector3Int gridPosition)
static

Get a RectInt of size 3x3 with the passed gridPostion as the center.

Parameters
gridPositionCenter for returned RectInt
Returns
3x3 RectInt

◆ LargestBoundsInt()

BoundsInt TilePlus.TpTileUtils.LargestBoundsInt ( IEnumerable< BoundsInt > input)
static

Get the largest BoundsInt from a list of BoundsInts.

◆ MakeMatrix2D()

Matrix4x4 TilePlus.TpTileUtils.MakeMatrix2D ( Vector3 position,
Vector3 rotation,
Vector3 scale )
static

Convience function to create Matrix 4x4 from position, rotation (Z only), scale, but optimized for tile sprites which don't support Z for position and scale.

Parameters
positionposition (X and Y only, Z forced to zero)
rotationrotation (Z only)
scalescale(x and Y only, Z forced to 1)
Returns

◆ NextDirectionType4()

DirectionType4 TilePlus.TpTileUtils.NextDirectionType4 ( DirectionType4 d)
static

clockwide direction movement for four directions

Parameters
da direction type enum value
Returns
the next direction type

up->right, right->down, down->left, left->up

If d == DirectionType4.None then the value of d is returned.

◆ NextDirectionType8()

DirectionType8 TilePlus.TpTileUtils.NextDirectionType8 ( DirectionType8 d)
static

clockwide direction movement for 8 direction coordinate space.

Parameters
da direction type 8 enum value
Returns
the next direction type 8

If d == DirectionType8.None then the value of d is returned.

◆ RandomPosInBounds()

Vector3 TilePlus.TpTileUtils.RandomPosInBounds ( Bounds bounds)
static

Get a random world position within bounds.

Parameters
boundsa bounds
Returns
a random Vector3 position within bounds

◆ RectIntFromBoundsInt()

RectInt TilePlus.TpTileUtils.RectIntFromBoundsInt ( BoundsInt boundsInt,
Vector3Int offset )
static

Create a RectInt from a BoundsInt. Ignores the BoundsInt Position.

Parameters
boundsIntInput BoundsInt
offsetThis is added to the boundsInt's offset. Useful as an offset from that position: e.g., a tile's offset. If not needed just use Vector3Int.zero
Returns
RectInt

Normally this is intended for use when processing a tile's ZoneBoundsInt when a zone is being used. In these cases, you always want to offset the ZoneBoundInt's position with the tile's position so that the resultant RectInt returned from this position is positioned properly relative to the tile.

◆ RotatationMatixZ()

Matrix4x4 TilePlus.TpTileUtils.RotatationMatixZ ( float angle)
static

Get a Matrix4x4 for an angle.

Parameters
angleThe angle.
Returns
Rotation matrix

◆ RoundVector3()

Vector3 TilePlus.TpTileUtils.RoundVector3 ( Vector3 input,
int digits )
static

Round an input Vector3 to n digits.

Parameters
inputvalue to round
digitsnumber of digits of precision
Returns
rounded value of input

◆ ScaleMatrix()

Matrix4x4 TilePlus.TpTileUtils.ScaleMatrix ( Vector3 scale,
Vector3 position )
static

Get a Matrix4x4 for scaling.

Parameters
scalescale
positionposition
Returns
Scaling matrix

◆ SetTileSpriteColor()

void TilePlus.TpTileUtils.SetTileSpriteColor ( TilePlusBase tpb,
Color value )
static

Set a Tile sprite color.

◆ SetTileSpritePosition()

void TilePlus.TpTileUtils.SetTileSpritePosition ( TilePlusBase tpb,
Vector3 value,
bool constantRotationAndScale = true )
static

Set a Tile sprite position.

Parameters
tpbtile instance
valuenew position
constantRotationAndScaleDefault = true. Keep existing rotation and scale

◆ SetTileSpriteRotation()

void TilePlus.TpTileUtils.SetTileSpriteRotation ( TilePlusBase tpb,
Vector3 value,
bool constantScaleAndPosition = true )
static

Set a Tile sprite rotation.

Parameters
tpbtile instance
valuerotation value
constantScaleAndPositiondefault = true. Don't change scale and position

◆ SetTileSpriteScale()

void TilePlus.TpTileUtils.SetTileSpriteScale ( TilePlusBase tpb,
Vector3 value,
bool constantPositionAndRotation = true )
static

Set a Tile sprite scale.

Parameters
tpbtile instance
valuenew scale
constantPositionAndRotationdefault=true. Keep existing position and rotation.

◆ SetTransform()

Matrix4x4 TilePlus.TpTileUtils.SetTransform ( Tilemap map,
Vector3Int position,
Vector3 tPosition,
Vector3 tRotation,
Vector3 tScale )
static

Set the transform for a tile. Convenience function.

Parameters
maptilemap
positionposition on map
tPositionposition for the tile transform
tRotationrotation for the tile transform
tScalescale for the tile transform

Handy for tweening the transform (pos,scale,rot) of a tile's sprite

No checking for whether or not a tile exists at that position

Returns
The matrix that was generated.

◆ SwapTiles()

bool TilePlus.TpTileUtils.SwapTiles ( TilePlusBase a,
TilePlusBase b,
bool tween = false,
TpTweenSpec.Tween? tweenSpec = null,
float tweenDuration = 0::25f,
TpEasingFunction.Ease easeFunction = TpEasingFunction::Ease::Linear,
bool debug = false )
static

Swap two TilePlus tiles. Optional tweening.

Parameters
aTPT Tile A
bTPT Tile B
tweendo a tween if true
tweenSpecOptional TweenSpec.Tween. If not null then tweenDuration and easeFunction IGNORED.
tweenDurationif tweening, the duration
easeFunctionif tweening, the ease function.
debugset true for debug info -> console.
Returns
false for error

Fails if the tiles' parent Tilemaps are not the same


The documentation for this class was generated from the following file:
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpTileUtils.cs