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

Implements a button with hover. Can be a toggle or momentary. REQUIRES a clipset with THREE animations whose names match those provided in this instance. Note that the inactive animation can be just one tile if that works for you. If the tile's sprite or default sprite are not the same as the single sprite that may or may not be what you want. Once animation begins it's not possible to return to the default sprite, so the "Inactive" animation is used. More...

Inheritance diagram for TilePlus.UiAnimButtonTile:
Collaboration diagram for TilePlus.UiAnimButtonTile:

Public Member Functions

override bool StartUp (Vector3Int position, ITilemap tilemap, GameObject go)
 StartUp tests for valid fields.
Public Member Functions inherited from TilePlus.TpFlexAnimatedTile
virtual void OnEnable ()
 OnEnable event handler.
void ChangeAnimation (string newAnimName)
 Change animation. Animation is turned on and the tile is refreshed. If animation is already running then RestartAnimation is used.
virtual void RestartAnimation (string optionalNewAnimation="")
 Restart an animation. If animation isn't running, uses ActivateAnimation(true).
override void ActivateAnimation (bool turnOn, int startingFrame=0, bool ignoreRewindingState=false)
 Use this to turn animation on and off. Note that restarting a running animation isn't automatic. Check animationOn field (in a subclass) or AnimationIsOn property from other code, and if it's true then use RestartAnimation instead.
override void LoopEndedCallback ()
 loop-ended callback from Tilemap.
override void PauseAnimation (bool pause)
 Pause a running animation.
Parameters
pause

override bool StartUp (Vector3Int position, ITilemap tilemap, GameObject go)
 StartUp method for TpFlexAnimatedTile.
override void GetTileData (Vector3Int position, ITilemap tilemap, ref TileData tileData)
 Retrieves tile rendering data.
override bool GetTileAnimationData (Vector3Int position, ITilemap tilemap, ref TileAnimationData tileAnimationData)
 Get animation info for this tile.
override void ResetState (TileResetOperation op)
 Used to reset state variables. May need overriding in subclasses. See programmer's guide for info on overriding this.
override bool UpdateInstance (string[] value)
 Default inplementation of UpdateInstance.an array of field names that have been changed in the Editor via the ImGuiTileEditor module
Public Member Functions inherited from TilePlus.TilePlusBase
override bool StartUp (Vector3Int position, ITilemap tilemap, GameObject go)
 Tiles can be in three states: Asset, Clone, Locked. See the Programmer's Guide for more info. NOTE: if overriding this BE SURE to call this base method as the FIRST thing you do! Note the return value and return FALSE if this base method returns FALSE.
override void GetTileData (Vector3Int position, ITilemap tilemap, ref TileData tileData)
 Get data for this tile. Override of Tile. Note that Tilemap.RefreshTile calls this.
virtual void CleanUp ()
 Implement to perform cleanup. RequiresCleanup
override string ToString ()
Public Member Functions inherited from TilePlus.ITilePlus
bool ExecEventAction (UnityEngine.Object? obj)
 Exec the event action, if any.
Public Member Functions inherited from TilePlus.ITpMessaging< in T >
void MessageTarget (T sentPacket)
 Send a message of type T.
bool CanAcceptMessage ()
 Optional "are you ready?" method that can be used in filtering prior to sending a message. Useful in some edge cases. Override in implementation if necc. NOTE this is NOT checked internally somehow. You have to use a filter and test this.

Public Attributes

float m_HighlightTime = 0.25f
 Highlight/lockout time.
string m_ClickedAnimationName = "clicked"
 Highlighting clip.
string m_HoverAnimationName = "hover"
 Hover clip.
string m_InactiveAnimationName = "default"
 Inactive clip.
bool m_AcceptClicks = true
 Accept clicks>
bool m_AcceptHover = true
 Accept Hover?
bool m_IsToggle
 If true, acts as toggle rather than momentary.
bool m_UseTargetTag
 If checked, send the TargetTag to the EventAction (if any).
string m_TargetTag = ""
 Target tag to use if UseTargetTag is true.
Public Attributes inherited from TilePlus.TpFlexAnimatedTile
bool m_PlayOnStart = true
 Play animation on Startup.
Spritem_DefaultSprite
 Default sprite when selected animation sequence is invalid.
TpSpriteAnimationClipSetm_ClipSet
 The asset with the animation clips.
bool m_UseAnimationSpeedOverride
 Override clip animation speed if true.
float m_AnimationSpeedOverride = 1
 Value used to override clip animation speed.
bool m_ForceOneShot
 See the description of TileAnimationFlags in the Unity scripting reference. Override animation clip one-shot setting to FORCE one-shot for any clip.
bool m_RewindAfterForcedOneShot
 If Force-One shot animation is used, this flag determines if a rewind occurs.
bool m_UpdatePhysics
 See the description of TileAnimationFlags in the Unity scripting reference. This controls the UpdatePhysics flags.
Public Attributes inherited from TilePlus.TilePlusBase
int count
 Property to get a tuple of (count, array of individually-trimmed tags). not cached.
ColliderMode m_ColliderMode = ColliderMode.NoCollider
 Used to set up the tile's collider.
SpriteClearMode m_TileSpriteClear = SpriteClearMode.Ignore
 m_TileClear controls whether or not the tile's sprite is cleared or if the tile is deleted at runtime, or nothing.
string m_Tag = string.Empty
 The tag for this tile.
OversizeSpriteMode m_OversizeSpriteMode = OversizeSpriteMode.Ignore
 How to handle oversize sprite recognition.
Vector2 m_SpriteSize = Vector2.one
 The true size of the tile sprite. See Oversize Sprite Mode.
TpTileEventActionm_EventAction
 TpTileEventAction project asset reference. May be null.
TpTileZoneActionm_ZoneAction
 TpTileZoneAction project asset reference. May be null.
bool m_ZoneIsInUse = false
 Zone capabilities active.
Public Attributes inherited from TilePlus.ITilePlus
int count
 Property to get an array of individually-trimmed tags.

Properties

override? object EventActionObject [get, set]
 If a tile is using TpEvents to pass events to a EventAction and said tile wants to include an arbitrary data object, make it available through this property. It will be passed to the event action in the 'obj' input parameter. TpUiButtonEventAction.Exec
Properties inherited from TilePlus.TpFlexAnimatedTile
bool AnimationSupported [get]
 This tile supports animation if true.
int AnimationClipIndex [get]
 read-only access to animation index: which clip is being used.
override bool IsOneShotWaitingToRewind [get]
 Is the animation waiting to rewind?
string TileAniClip [get]
 A string with animation clipset name.
string CurrentAniClipName [get]
 Current animation clip name.
Action? OneShotEndedCallback [get, set]
 Callback invoked after a one-shot animation has completed. Note: this should be a very short method.
Properties inherited from TilePlus.TilePlusBase
bool SpriteShouldBeCleared [get]
 Returns true if tile sprite should be cleared based on setting of TileSpriteClear field, tile state, and whether in Play mode or not.
byte?[] TileGuidBytes [get, set]
 The clone's GUID. Note that IDs are individual for each clone. This value can only be set once. Calling ResetState allows it to be changed until the next StartUp. If a new GUID isn't added before StartUp then that method will add it. For example: see TpLib.CopyAndPasteTile Note: generally speaking, don't reset the GUID.
string TileName [get]
TilePlusBase ThisTileInstance [get]
 Get the tile's instance thru this interface.
int Id [get]
 Id of tile. Nominally GetInstanceId. Default returns 0.
bool GetTileDataHasRun [get]
 TRUE if GetTileData has run. If this is false when TpLib.RegisterTilePlus is executed then TpLib checks to see if the tile's sprite needs to be affected. See that code for an explanation.
static Vector3Int ImpossibleGridPosition = new(int.MinValue, int.MinValue, int.MinValue) [get]
 No tile will ever be here!
Vector3Int TileGridPosition [get]
 This is the tile grid position as set from StartUp. Intentionally non-virtual. Does not need (and should not have) serialized backing field. Note that backing field is initialized to "Impossible Grid Position".
Vector3 TileWorldPosition [get]
 Handy property to get the world position from the TileGridPosition property. returns Vector3.negativeInfinity for error SO CHECK FOR THAT! note: returns cell center as world position.
Vector3Int LastTileGridPosition [get]
 Get the last tile grid position Note that backing field is initialized to "Impossible Grid Position".
Tilemap? LastParentTilemap [get]
 Get the last parent Tilemap. Note that backing firld is initialized to NULL.
bool TileGridPosHasChanged [get]
 Has the tile position changed since the last StartUp?
bool ParentTilemapHasChanged [get]
 Has the tile's parent tilemap changed since the last StartUp?
Tilemap? ParentTilemap [get]
 Parent tilemap for this tile (set in clone). Intentionally non-virtual. Does not need (and should not have) serialized backing field.
int ParentTilemapInstanceId [get]
 The instance ID of the parent tilemap.
bool AnimationIsPaused [get]
 Property to determine if animation is PAUSED.
virtual bool IsOneShotWaitingToRewind [get]
 Override in any animated tiles.
bool TileAnimationActive [get]
 Property to determine if animation is running in the tile. Note: running=true and paused=true is fine.
bool AnimationIsRunning [get]
 Property to determine if Tile animation is ACTIVE and not paused: IE actual animation is running.
bool IsClone [get]
 Is this a clone? Read-only.
bool IsAsset [get]
 Is this an asset? Read-only.
bool IsLocked [get]
 Is this a locked tile? Read-only.
bool IsPaletteTile [get, set]
 Valid only in-editor, is this tile from the Palette?
string TileStateString [get]
 String version of TileState.
Guid TileGuid [get]
 Get the tile's GUID as a GUID struct.
string TileGuidString [get]
 The clone's GUID as a string.
int string[] tags TrimmedTags [get]
virtual bool RequiresCleanup [get]
 If a particular tile requires special cleanup prior to deletion, EXPLICITLY implement this method and return TRUE. TpZoneAnimator
bool SanityCheck [get]
 If handling an animation callback, this is useful to ensure that the TPT tile instance is actually still attached to a Tilemap and not just transiently sitting in memory (ie deleted but not yet purged from a List or HashSet somewhere.
static TpTweener TweenerService [get]
 GET a reference to the tweener service. It's only used by TilePlus tiles.
virtual ColliderMode TileColliderMode [get, set]
 Used to set up the tile's collider.
SpriteClearMode TileSpriteClear [get, set]
 Get the the tile sprite clear mode.
string Tag [get, set]
 Property to get the optional tag.
OversizeSpriteMode OversizeSpriteMode [get]
 This is used by the PositionDb to calculate the actual size of a sprite when determining if a position is occupied.
Vector2 SpriteSize [get]
 What is the size of the sprite? Override when implementing OversizeSpriteMode.
TpTileEventActionEventAction [get]
 A TpTileEventAction.
virtual ? object EventActionObject [get, set]
TpTileZoneActionZoneAction [get]
 A TpTileZoneAction.
BoundsInt ZoneBoundsInt [get, set]
 The BoundsInt for the zone.
Bounds ZoneBounds [get]
 A bounds based on the ZoneBoundsInt.
Properties inherited from TilePlus.ITilePlus
Scene ParentScene [get]
 Return the scene that the Tile is in. Only works on a placed tile; on a non-cloned tile it should return default Note: check the return value for Scene.IsValid.
bool IsComputeOnly [get]
 Indicate that this tile is 'compute only'.
GameObject? InstantiatedGameObject [get]
 Get the GameObject of the tile. Convenience, saves casting in editors.
Properties inherited from TilePlus.IZoneActionTarget
bool AcceptsZoneAction [get]
 Is this tile a valid target?

Additional Inherited Members

Protected Member Functions inherited from TilePlus.TilePlusBase
void SetColliderType (ref TileData tileData)
 Sets up colliders.
Protected Attributes inherited from TilePlus.TpFlexAnimatedTile
string? m_ActiveAnimationClipName = "default"
 Name of the active animation sequence. Intentionally not shown in Inspector Note this DOES NOT UPDATE AT RUNTIME. To get the active animation clip name at runtime use the TileAniClip property.
Protected Attributes inherited from TilePlus.TilePlusBase
Vector3Int m_TileGridPosition = new(int.MinValue, int.MinValue, int.MinValue)
 The tile grid position gets initialized in Startup. It's initialized with 'ImpossibleGridPosition'.
Vector3Int m_LastTileGridPosition = new(int.MinValue, int.MinValue, int.MinValue)
 The previous tile grid position.
Tilemap? m_LastParentMap
 The previous parent Tilemap.
bool m_TileGridPosHasChanged
 True if the tile grid position has changed.
bool m_ParentTilemapHasChanged
 Parent tilemap has changed if true.
Tilemap? m_ParentTilemap
 Parent tile map is initialized in Startup.
BoundsInt m_ZoneBoundsInt = new(Vector3Int.zero,new Vector3Int(3,3,1))
 BoundsInt of trigger zone. Initialized to a 3x3 area centered at the Tile's location.

Detailed Description

Implements a button with hover. Can be a toggle or momentary. REQUIRES a clipset with THREE animations whose names match those provided in this instance. Note that the inactive animation can be just one tile if that works for you. If the tile's sprite or default sprite are not the same as the single sprite that may or may not be what you want. Once animation begins it's not possible to return to the default sprite, so the "Inactive" animation is used.

Member Function Documentation

◆ StartUp()

override bool TilePlus.UiAnimButtonTile.StartUp ( Vector3Int position,
ITilemap tilemap,
GameObject go )

StartUp tests for valid fields.

Parameters
positionposition
tilemapmap
gogameObj
Returns

Member Data Documentation

◆ m_AcceptClicks

bool TilePlus.UiAnimButtonTile.m_AcceptClicks = true

Accept clicks>

◆ m_AcceptHover

bool TilePlus.UiAnimButtonTile.m_AcceptHover = true

Accept Hover?

◆ m_ClickedAnimationName

string TilePlus.UiAnimButtonTile.m_ClickedAnimationName = "clicked"

Highlighting clip.

◆ m_HighlightTime

float TilePlus.UiAnimButtonTile.m_HighlightTime = 0.25f

Highlight/lockout time.

Tile won't respond to clicks for this time interval/

◆ m_HoverAnimationName

string TilePlus.UiAnimButtonTile.m_HoverAnimationName = "hover"

Hover clip.

◆ m_InactiveAnimationName

string TilePlus.UiAnimButtonTile.m_InactiveAnimationName = "default"

Inactive clip.

◆ m_IsToggle

bool TilePlus.UiAnimButtonTile.m_IsToggle

If true, acts as toggle rather than momentary.

◆ m_TargetTag

string TilePlus.UiAnimButtonTile.m_TargetTag = ""

Target tag to use if UseTargetTag is true.

◆ m_UseTargetTag

bool TilePlus.UiAnimButtonTile.m_UseTargetTag

If checked, send the TargetTag to the EventAction (if any).

Property Documentation

◆ EventActionObject

override? object TilePlus.UiAnimButtonTile.EventActionObject
getset

If a tile is using TpEvents to pass events to a EventAction and said tile wants to include an arbitrary data object, make it available through this property. It will be passed to the event action in the 'obj' input parameter. TpUiButtonEventAction.Exec

Implements TilePlus.ITilePlus.


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