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

This is a sub-object to be added to Event and/or Zone actions. This can be used as a base class. The implementation here plays a sequence. More...

Inheritance diagram for TilePlus.TpTweenerSubObject:
Collaboration diagram for TilePlus.TpTweenerSubObject:

Public Member Functions

long PlaySequence (TilePlusBase tile, bool relative=true, int[]? indices=null, int numLoops=-1, Action< TpTweenSequence, bool >? onFinished=null, Action< TpTweenSequence, TpTween >? onNextTween=null, bool evenIfAlreadyRunning=false)
 Play a sequence using a TweenSpec asset referenced by this S.O.

Public Attributes

TpTweenSpecm_TpTweenSpec
 A tween-spec asset ref.

Detailed Description

This is a sub-object to be added to Event and/or Zone actions. This can be used as a base class. The implementation here plays a sequence.

///

You don’t want to maintain state of any kind in an TweenerSubObject asset’s code unless you use it with only ONE tile asset. Similarly to other assets, changing serialized values in these assets in Editor-Play mode can cause all sorts of issues.

NOTE that for this subobject to be inspectable in Painter or Tile+Brush Selection Inspector, the TptShowObjectField attr in the tile must have the m_HasSubasset param true. Event and Zone Actions added in the TilePlusBase section of the Selection Inspector do this automatically. However, the Event or Zone action MUST implement ScriptableObject? IActionPlugin.InspectableObject from the IActionPlugin interface. The base classes TpTileZoneAction and TpTileEventAction already do this. Hence, normally this just works automatically, however if you're providing a different implementation somehow, this info may be useful! /remarks>

Member Function Documentation

◆ PlaySequence()

long TilePlus.TpTweenerSubObject.PlaySequence ( TilePlusBase tile,
bool relative = true,
int ?[] indices = null,
int numLoops = -1,
Action< TpTweenSequence, bool >? onFinished = null,
Action< TpTweenSequence, TpTween >? onNextTween = null,
bool evenIfAlreadyRunning = false )

Play a sequence using a TweenSpec asset referenced by this S.O.

Parameters
tileparent tile.
relativeIf true, the tweenSpec params are modified to use the initial conditions of the item being tweened. EG, if SCALE is being tweened, the EndValue is modified to reflect the initial SCALE of the tile's sprite. This only applies to SCALE, POSITION, and ROTATION.
indicesan array of indices into the Tween spec list. If not null, this array of indices is used to choose tweens (in the order you specify) in a sequence. If null, ALL of the items in the tweenSpec are used. If an index is out of range then it is silently ignored.

///

Parameters
numLoopsnumber of loops (default = -1 which is infinite repeat.
onFinishedOnFinished callback
onNextTweenOnNextTween callback
evenIfAlreadyRunningNormally this SubObj won't start a sequence if there's already one running for this tile. Set this true if you don't care about that.
Returns
0 if the tween spec was null or if the sequence could not be created. If the sequence was created but couldn't play then -1 is returned and the sequence is discarded.
See also
TpTweener.CreateSequenceFromSpec

Member Data Documentation

◆ m_TpTweenSpec

TpTweenSpec? TilePlus.TpTweenerSubObject.m_TpTweenSpec

A tween-spec asset ref.


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