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

Tweener/Sequencer Scriptable Runtime Service (SRS) More...

Inheritance diagram for TilePlus.TpTweener:
Collaboration diagram for TilePlus.TpTweener:

Public Types

enum  EaseTarget {
  Position , Rotation , Scale , Color ,
  ColorConstantA , Delay , Matrix , MatrixColor ,
  MatrixColorConstantA , UserDefined
}
 What to ease. More...
enum  GameObjTweenEaseTarget { Position , Rotation , Scale , Color }
 Ease Target for GameObjectTweens. More...
enum  LoopType { None , Loop , PingPong }
 Type of looping (or none) More...
enum  MatrixHints { None = 0 , NoScaling = 1 , NoRotation = 2 , NoPosition = 4 }
 Allows fine control over how MATRIX-style tweens work Note that if all the flags are true then nothing happens. More...

Public Member Functions

long GameObjectPositionBezierTween (GameObject go, Vector3[] points, float duration, long sequenceId=0L, LoopType loopType=LoopType.None, int numLoops=-1, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 Tween a GameObject's position along a Bezier curve along a set of points.
override void OnDisable ()
 Unity event method.
override void OnEnable ()
 OnEnable.
override string Status ()
 Status string.
override string Details (int length=-1)
 The SRS inspector utility will show whatever this returns.
Returns
a a string with details
accessed via reflection (editor only) don't change this to a prop or change the name
override bool CanPollForDetails ()
 Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.
Returns
T/F
accessed via reflection (editor only) don't change this to a prop or change the name
long CreateTween (TilePlusBase tpb, Vector3 endValue, Color endColor, Matrix4x4 endMatrix, TpEasingFunction.Ease ease, EaseTarget easeTarget, float duration, long sequenceId=0L, LoopType loopType=LoopType.None, int numLoops=-1, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null, MatrixHints matrixHints=MatrixHints.None, TpEasingFunction.Ease? matrixRotEase=null, TpEasingFunction.Ease? matrixScaleEase=null)
 Create a tween for tile transforms, runs immediately.
long CreateTweenFromSpec (TilePlusBase tpb, TpTweenSpec.Tween tweenSpec, long sequenceId=0L, float timeScale=0f, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 Play a tween using a TpTweenSpec.TweenItem as the template.
long CreateGoTweenFromSpec (GameObject go, TpGoTweenSpec.GoTween goTweenSpec, long sequenceId=0L, float timeScale=0f, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 Create a GameObject tween from a GoTweenSpec asset.
long CreateDelayTween (float duration, long sequenceId)
 Create a Delay tween. Use to obtain and add a Delay to a sequence.
long CreateGoTween (GameObject? gameObject, Action< TpTween, float >? gameObjectAction, TpEasingFunction.Ease ease, float duration, long sequenceId=0L, LoopType loopType=LoopType.None, int numLoops=-1, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 Create a tween for GameObjects, runs immediately. Note that you should normally use GameObjectColor and GameObjectTrs which are wrappers for this method but less customizable.
TpTweenGetTween (long id)
 Get a tween instance. This is a live, running tween.
TpTweenGetTweenFromSequence (long sequenceId, long tweenId)
 Get a tween with ID from sequence with an Id.
string GetTweenInfo (long id)
 Get the ToString of an ACTIVE tween without retrieving the instance.
bool KillTween (long id)
 Kill an ACTIVE tween with a given ID and return the instance to the pool.
bool IsRunningTween (long id)
 Is a tween with given ID running.
TpTweenCopyTweener (long id)
 Get a copy of a tween for diagnostics.
long CreateSequence (string sName, int size=2, int numLoops=0, bool isGameObjectSequence=false, Action< TpTweenSequence, bool >? onFinished=null, Action< TpTweenSequence, TpTween >? onNextTween=null)
 Create an empty sequence and add it to the PendingSequences dictionary. Retrieve it with GetSequence and populate it with one of the three Create methods, passing in the sequence ID, then use PlaySequence.
long CreateSequenceFromSpec (TilePlusBase tpb, TpTweenSpec tweenSpec, int[]? indices=null, int numLoops=0, Action< TpTweenSequence, bool >? onFinished=null, Action< TpTweenSequence, TpTween >? onNextTween=null, float timeScale=0f)
 Create a sequence from a TpTweenSpec. Uses ALL tweens in the list.
long CreateSequenceFromGoSpec (TpGoTweenSpec goTweenSpec, GameObject go, int[]? indices=null, int numLoops=0, Action< TpTweenSequence, bool >? onFinished=null, Action< TpTweenSequence, TpTween >? onNextTween=null, float timeScale=0f)
 Create a sequence from a TpTweenSpec. Uses ALL tweens in the list.
bool PlaySequence (TilePlusBase? parent, long sequenceId)
 Play a sequence.
bool KillRunningSequence (long sequenceId)
 Kill a running sequence given it's sequenceId.
bool DeletePendingSequence (long sequenceId)
 Delete sequence from pending sequences.
string GetSequenceInfo (long id)
 Get the ToString of a sequence without retrieving the instance.
void ResetSequencer ()
 Reset the sequencer.
void ResetTweener (bool complete=false)
 Partial or complete reset of Tweener.
void GetInfoOnAllRunningTweens (ref List< string > info, int max)
 Get the ToString of all running tweens.
void GetInfoOnAllRunningSequences (ref List< string > info, int max)
 Ge the ToString for all running sequences.
bool HasSequenceForTile (TilePlusBase tile, bool both=true)
 Is there a running and/or pending sequence for this tile?
bool HasRunningTweenForTile (TilePlusBase tile)
 Is there a running tween for this tile?
bool HasAnyRunningTweenForTiles (TilePlusBase[] tiles)
 Is there a running tweens for ANY tile in an array of tiles. Use infrequently, is inefficient (creates ~256 bytes GC).
Awaitable? TweenAsAwaitable (long id)
 Convenience method: return a tween as an Awaitable<bool>.
Awaitable? PendingSequenceAsAwaitable (long id)
 Convenience method: return a PENDING sequence as as an Awaitable<bool>.
long GameObjectTrs (GameObjTweenEaseTarget easeTarget, GameObject go, Vector3? startValue, Vector3 endValue, float duration, TpEasingFunction.Ease ease, Action< TpTween, float >? customGameObjectAction=null, long sequenceId=0L, LoopType loopType=LoopType.None, int numLoops=-1, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 TRS (Translation, Rotation, Scale) a GameObject.
long GameObjectColor (GameObject go, Color? startValue, Color endValue, float duration, TpEasingFunction.Ease ease, long sequenceId=0L, LoopType loopType=LoopType.None, int numLoops=-1, Action< TpTween >? onFinished=null, Action< TpTween, float >? onRewindOrPingPong=null, Action< TpTween >? onLoopEnded=null, Action< TpTween, float >? onUpdate=null)
 Tween Color for a sprite renderer.
Public Member Functions inherited from TilePlus.ScriptableRuntimeService< T >
override string ToString ()
 Customize ToString in overrides.
Public Member Functions inherited from TilePlus.IScriptableService
void MessageTarget (ObjectPacket packet)
 If Accepts messages is true, reimplement this to get messaged.

Properties

bool HasTweensOrSequences [get]
 Are there any active tweens or sequences?
int NumActiveTweens [get]
 How many tweens?
int NumActiveSequences [get]
 How many active sequences?
bool Diagnostics = false [get, set]
 Adds additional checks for invalid/insane tweens.
bool SafeMode = true [get, set]
 If true, tweens are checked for 'Sanity' before use. 'Sanity' means that the tile parent isn't null and its map isn't null. Setting this false can increase performance if you have many tweens.
Properties inherited from TilePlus.ScriptableRuntimeService< T >
string ServiceName [get]
 A name for this service: used for profiling. Ordinarily just returns the 'name' property of the Service S.O. instance.
Properties inherited from TilePlus.IScriptableService
bool PeristThruReload [get]
 If true, this will not be deleted when the Unity scene changes.
string[] AcceptableMessages [get]
 If true, can accept ObjectPacket messages from the Service Manager with command-strings matching those returned here.

Additional Inherited Members

Static Protected Member Functions inherited from TilePlus.ScriptableRuntimeService< T >
static void Create ()
 Create and initialize method.

Detailed Description

Tweener/Sequencer Scriptable Runtime Service (SRS)

How to use:

– Obtain a handle using TpServiceManager or use the protected static TpTweener TweenerService method within any TPT tile code.

– Create a tween using CreateTween, CreateDelayTween, CreateGoTween, or CreateTweenFromSpec. This returns a lookup ID for the tween. The tween runs immediately. Use this ID to kill the tween.

– Create a sequence using CreateSequence. An ID for this paused sequence is returned. Then add to the sequence using one of the Create methods above, supplying the sequence ID. The tween(s) are added to the sequence and do not run until the the sequence begins to run by your use of PlaySequence. Created but un-played sequences can be removed with DeletePendingSequence (Optional, edge case situation). Playing sequences can be killed with KillRunningSequence, which optionally can kill whatever tween is running. If a sequence is running and becomes invalid (i.e., its tile becomes null or its parent Tilemap becomes null, etc) it's auto-deleted.

– NOTE THAT when you request an empty sequence it's internally tagged for Tile tweens or GameObject tweens. – Adding Tile tweens to a GameObject-tagged sequence or vice versa is an error.

There are several tweening 'Targets' : Position, Rotation (Z only), Scale (x,y only), Color, and Delay. Delay is for use in sequences to add a delay between tweens.

There's no optional delay when starting a tween. If you need one just create a two-item sequence with the first item being a Delay tween and the second one with a Position, etc Target.

Member Enumeration Documentation

◆ EaseTarget

What to ease.

Enumerator
Position 

Tile sprite position.

Rotation 

Tile sprite rotation.

Scale 

Tile sprite scale.

Color 

Tile sprite color.

ColorConstantA 

Tile sprite color, alpha always fkept at the starting value.

Delay 

NO tweening: instead, marks this as a DELAY in a TpTweenSequence. If this is used when starting a tween any other way the tween creation function will return 0, which indicates an error. TpTweenSequence

Matrix 

Tweens a raw Matrix4x4 as separate Scale, Position, Rotation tweens. Use if you want to tween any two of these in the same tween.

MatrixColor 

Matrix and Color. Change everything with one tween.

MatrixColorConstantA 

Matrix and Color, with Alpha kept at the starting value.

UserDefined 

User-defined tween evaluation.

◆ GameObjTweenEaseTarget

Ease Target for GameObjectTweens.

Enumerator
Position 

Position.

Rotation 

Rotation.

Scale 

Scale.

Color 

Color: only used internally. Is error if used as param to GameObjectTrs.

◆ LoopType

Type of looping (or none)

Enumerator
None 

no looping

Loop 

normal loop with rewind to start

PingPong 

Ping-pong loop.

◆ MatrixHints

Allows fine control over how MATRIX-style tweens work Note that if all the flags are true then nothing happens.

Enumerator
None 

Never makes sense.

NoScaling 

No scaling changes.

NoRotation 

No rotation changes.

NoPosition 

No Position changes.

Member Function Documentation

◆ CanPollForDetails()

override bool TilePlus.TpTweener.CanPollForDetails ( )
virtual

Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.

Returns
T/F
accessed via reflection (editor only) don't change this to a prop or change the name

Reimplemented from TilePlus.ScriptableRuntimeService< T >.

◆ CopyTweener()

TpTween? TilePlus.TpTweener.CopyTweener ( long id)

Get a copy of a tween for diagnostics.

Parameters
idthe ID
Returns
a COPY of the tween or null if not found

Good for troubleshooting, this is an UNPOOLED instance.

◆ CreateDelayTween()

long TilePlus.TpTweener.CreateDelayTween ( float duration,
long sequenceId )

Create a Delay tween. Use to obtain and add a Delay to a sequence.

Parameters
durationdelay time
sequenceIdREQUIRED. 0 will create a warning and the DELAY won't be created.
Returns
false if sequence ID is 0 or if the sequence ID doesn't represent a created sequence.

◆ CreateGoTween()

long TilePlus.TpTweener.CreateGoTween ( GameObject? gameObject,
Action< TpTween, float >? gameObjectAction,
TpEasingFunction.Ease ease,
float duration,
long sequenceId = 0L,
LoopType loopType = LoopType::None,
int numLoops = -1,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

Create a tween for GameObjects, runs immediately. Note that you should normally use GameObjectColor and GameObjectTrs which are wrappers for this method but less customizable.

Parameters
gameObjectthe target GameObject.
gameObjectActionAn Action to update the gameObj somehow. Gets tween and progress. DONT MODIFY THE TWEEN INSTANCE!!
easeA value from the TpEasingFunction.Ease enum.
durationtime for the tween to complete.
sequenceIdif not 0, the tween is added to the sequence and NOT played.
loopTypeNone, Loop, PingPong
numLoopsHow many loops if loopType isn't 'None'. If loop type is ping-pong this number is internally doubled.
onFinishedcallback when tween completes
onRewindOrPingPongcallback on rewind or pingpong
onLoopEndedcallback when loop ended
onUpdatecallback on Update FOR EACH TWEEN
Returns
A long which is the ID for the tween. Returns 0 for error

OnFinished, OnRewindOrPingPong, OnLoopEnded pass the TpTween instance. Do not keep it! For OnFinished/OnLoopEnded the instance is very quickly reset and returned to the pool so its contents will NOT be valid after the callback returns to this Service.

◆ CreateGoTweenFromSpec()

long TilePlus.TpTweener.CreateGoTweenFromSpec ( GameObject go,
TpGoTweenSpec.GoTween goTweenSpec,
long sequenceId = 0L,
float timeScale = 0f,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

Create a GameObject tween from a GoTweenSpec asset.

Parameters
gotarget GameObject
goTweenSpecspec list
sequenceIdsequence ID or 0
timeScalescale duration
onFinishedonFinished callback
onRewindOrPingPongOnRewindOrPingPong callback
onLoopEndedOnLoopEnded callback
onUpdatecallback every update
Returns

◆ CreateSequence()

long TilePlus.TpTweener.CreateSequence ( string sName,
int size = 2,
int numLoops = 0,
bool isGameObjectSequence = false,
Action< TpTweenSequence, bool >? onFinished = null,
Action< TpTweenSequence, TpTween >? onNextTween = null )

Create an empty sequence and add it to the PendingSequences dictionary. Retrieve it with GetSequence and populate it with one of the three Create methods, passing in the sequence ID, then use PlaySequence.

Parameters
sNameName for the sequence. Typ use Tile's name.
sizeinital size of the internal list of tweens used by this sequence
numLoopsNumber of times this sequence repeats. 0 OR 1 means it only plays once. -1 plays until killed
isGameObjectSequenceset true if you will use this sequence for GameObject tweens
onFinishedcallback when the sequence is complete. a bool sent to the callback is true for an actual completion or false if the sequence is complete but will repeat.
onNextTweencallback when the next tween is about to start. Note: could be a 'delay' tween; one with EaseTarget = Delay. EaseTarget
Returns
ID of the sequence. 0 indicates an error.

If a tween is Loop or PingPong and the #loops is -1 (infinite) then that tween is discarded and a warning is sent to the console.

Note that sequence elements that have the DELAY EaseTarget can be used to have delays between actual tweens.

If numLoops is > 0 then the tweens are NOT returned to the pool until all loops have completed or the sequence is deleted with KillRunningSequence.

◆ CreateSequenceFromGoSpec()

long TilePlus.TpTweener.CreateSequenceFromGoSpec ( TpGoTweenSpec goTweenSpec,
GameObject go,
int?[] indices = null,
int numLoops = 0,
Action< TpTweenSequence, bool >? onFinished = null,
Action< TpTweenSequence, TpTween >? onNextTween = null,
float timeScale = 0f )

Create a sequence from a TpTweenSpec. Uses ALL tweens in the list.

Parameters
goGameObject
goTweenSpecTween spec list
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.
numLoopsHow many loops this sequence should make
onFinishedOnFinished callback
onNextTweenOnNextTween callback
timeScaleif positive and nonzero, all of the sequence's tweens durations are scaled. For example, 0.5 would slow down and 1.5 would speed up
Returns
Sequence ID or 0 for failure

◆ CreateSequenceFromSpec()

long TilePlus.TpTweener.CreateSequenceFromSpec ( TilePlusBase tpb,
TpTweenSpec tweenSpec,
int?[] indices = null,
int numLoops = 0,
Action< TpTweenSequence, bool >? onFinished = null,
Action< TpTweenSequence, TpTween >? onNextTween = null,
float timeScale = 0f )

Create a sequence from a TpTweenSpec. Uses ALL tweens in the list.

Parameters
tpbParent tile
tweenSpecTween spec list
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.
numLoopsHow many loops this sequence should make
onFinishedOnFinished callback
onNextTweenOnNextTween callback
timeScaleif positive and nonzero, all of the sequence's tweens durations are scaled. For example, 0.5 would slow down and 1.5 would speed up
Returns
Sequence ID or 0 for failure

◆ CreateTween()

long TilePlus.TpTweener.CreateTween ( TilePlusBase tpb,
Vector3 endValue,
Color endColor,
Matrix4x4 endMatrix,
TpEasingFunction.Ease ease,
EaseTarget easeTarget,
float duration,
long sequenceId = 0L,
LoopType loopType = LoopType::None,
int numLoops = -1,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null,
MatrixHints matrixHints = MatrixHints::None,
TpEasingFunction.Ease? matrixRotEase = null,
TpEasingFunction.Ease? matrixScaleEase = null )

Create a tween for tile transforms, runs immediately.

Parameters
tpbthe calling tile's instance (usu. 'this').
endValueThe final RELATIVE value for the tween. The start value is taken from the current tile-sprite's transform in the Tilemap.
endColorthe final value for the tween when EaseTarget is Color or MatrixColor
endMatrixthe final value for the tween when EaseTarget is Matrix
easeA value from the TpEasingFunction.Ease enum.
easeTargetEaseTarget.Position, .Rotation, or .Scale
durationtime for the tween to complete. Doubled when loop=pingpong See remarks.
sequenceIdif not 0, the tween is added to the sequence and NOT played.
loopTypeNone, Loop, PingPong
numLoopsHow many loops if loopType isn't 'None'. If loop type is ping-pong this number is internally doubled.
onFinishedcallback when tween completes
onRewindOrPingPongcallback on rewind or pingpong
onLoopEndedcallback when loop ended
onUpdatecallback on Update FOR EACH TWEEN
matrixHintsoptional FLAGS enum used with Matrix tweens. Allows only tweening certain parts of the matrix.
matrixRotEaseOptional Rotation ease function. If null, use 'ease'
matrixScaleEaseOptional Scale ease function. If null, use 'ease'
Returns
A long which is the ID for the tween. Returns 0 for error

If a tween is Ping-Pong looping then the duration is doubled. IE, the duration is 2 then ping duration is 2 and pong direction is 2.

Note that the OnUpdate callback DOES occur in builds. BUT it's not advised to use it frivolously, as it will update at the frame rate (Fixed Update timing) for EACH TWEEN; in other words, if you have 30 tweens running you'll get 30 callbacks EVERY frame.

OnFinished, OnRewindOrPingPong, OnLoopEnded, and OnUpdate pass the TpTween instance. Do not keep it! For OnFinished/OnLoopEnded the instance is very quickly reset and returned to the pool so its contents will NOT be valid after the callback returns to this Service.

It's important to note that the 'end' values are relative. So for example,if you specify a position tween with an endvalue of new Vector3(2,2,1) the position of the sprite moves two units in X and 2 units in Y and NOT to the absolute world position (2,2,1).

◆ CreateTweenFromSpec()

long TilePlus.TpTweener.CreateTweenFromSpec ( TilePlusBase tpb,
TpTweenSpec.Tween tweenSpec,
long sequenceId = 0L,
float timeScale = 0f,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

Play a tween using a TpTweenSpec.TweenItem as the template.

Parameters
tpbTile to tween
tweenSpecthe spec
sequenceIdif not 0, the tween is added to the sequence and NOT played.
onFinishedOnFinished callback
onRewindOrPingPongOnRewindOrPingPong callback
onLoopEndedOnLoopEnded callback
onUpdateOnUpdate callback (disabled in builds!)
timeScaleif positive and nonzero, all of the sequence's tweens durations are scaled. For example, 0.5 would slow down and 1.5 would speed up
Returns
the tween ID. 0 = error.

◆ DeletePendingSequence()

bool TilePlus.TpTweener.DeletePendingSequence ( long sequenceId)

Delete sequence from pending sequences.

Parameters
sequenceIdID
Returns
false if no such sequence exists or the removal from the PendingSequences dict fails.

◆ Details()

override string TilePlus.TpTweener.Details ( int length = -1)
virtual

The SRS inspector utility will show whatever this returns.

Returns
a a string with details
accessed via reflection (editor only) don't change this to a prop or change the name

Reimplemented from TilePlus.ScriptableRuntimeService< T >.

◆ GameObjectColor()

long TilePlus.TpTweener.GameObjectColor ( GameObject go,
Color? startValue,
Color endValue,
float duration,
TpEasingFunction.Ease ease,
long sequenceId = 0L,
LoopType loopType = LoopType::None,
int numLoops = -1,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

Tween Color for a sprite renderer.

Parameters
goTarget Game Object
startValueStart value for position (is NULLABLE, if null passed-in then the current position is used.
endValueEnd position.
durationDuration of the tween
easeEase function
sequenceIdIf adding to a sequence provide this number obtained from CreateSequence. 0L means no sequence. Using arbitrary sequence ID or one that's running is an error.
loopTypeSingle, loop, pingpong
numLoopshow many loops, -1 = forever
onFinishedCallback when complete (hijacked when part of a sequence).
onRewindOrPingPongCallback for rewind loop or pingpong (hijacked when part of a sequence>
onLoopEndedCallback for end of loop (hijacked when part of a sequence)
onUpdateCallback EVERY update. Avoid if possible.
Returns
The tween ID. TWEEN BEGINS IMMEDIATELY unless part of a sequence.

NOTE THAT unlike tile tweens, the start and end values are NOT relative to the current position. If you do not provide a startValue (pass-in null) then the current position is used as the starting position. If you DO provide a startValue and it ISN'T the current position then the GameObject will initially jump to that position. Note: rotation performed via Eulerangles

◆ GameObjectPositionBezierTween()

long TilePlus.TpTweener.GameObjectPositionBezierTween ( GameObject go,
Vector3[] points,
float duration,
long sequenceId = 0L,
LoopType loopType = LoopType::None,
int numLoops = -1,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

Tween a GameObject's position along a Bezier curve along a set of points.

Parameters
goGameObject
pointsarray of points. Note that size must be between 2 and 16.
durationelapsed time
sequenceId0L if not in a sequence, or a sequence ID from CreateSequence.
loopTypeSingle, loop, pingpong
numLoopshow many loops, -1 = forever
onFinishedCallback when complete (hijacked when part of a sequence).
onRewindOrPingPongCallback for rewind loop or pingpong (hijacked when part of a sequence>
onLoopEndedCallback for end of loop (hijacked when part of a sequence)
onUpdateCallback EVERY update. Avoid if possible.
Returns

The tween ID. TWEEN BEGINS IMMEDIATELY unless part of a sequence.

points[0] is the start position, GO will jump there if not already at that spot. Position[n-1] is the end position.

◆ GameObjectTrs()

long TilePlus.TpTweener.GameObjectTrs ( GameObjTweenEaseTarget easeTarget,
GameObject go,
Vector3? startValue,
Vector3 endValue,
float duration,
TpEasingFunction.Ease ease,
Action< TpTween, float >? customGameObjectAction = null,
long sequenceId = 0L,
LoopType loopType = LoopType::None,
int numLoops = -1,
Action< TpTween >? onFinished = null,
Action< TpTween, float >? onRewindOrPingPong = null,
Action< TpTween >? onLoopEnded = null,
Action< TpTween, float >? onUpdate = null )

TRS (Translation, Rotation, Scale) a GameObject.

Parameters
easeTargetIndicate Translation, Rotation, or Scale
goTarget Game Object
startValueStart value: is NULLABLE, if null passed-in then the current Position/Rotation/Scale is used.
endValueEnd position, rotation, scale.
durationDuration of the tween
easeEase function
customGameObjectActionA custom action to be used instead of the built-in Actions for position, rotation, and scale.
sequenceIdIf adding to a sequence provide this number obtained from CreateSequence. 0L means no sequence. Using arbitrary sequence ID or one that's running is an error.
loopTypeSingle, loop, pingpong
numLoopshow many loops, -1 = forever
onFinishedCallback when complete (hijacked when part of a sequence).
onRewindOrPingPongCallback for rewind loop or pingpong (hijacked when part of a sequence>
onLoopEndedCallback for end of loop (hijacked when part of a sequence)
onUpdateCallback EVERY update. Avoid if possible.
Returns
The tween ID. TWEEN BEGINS IMMEDIATELY unless part of a sequence.

For these Vector3-type tweens, if the startValue is null then you're requesting a 'relative' tween. What this means: the startValue is taken from the GameObject's transform position, rotation, or scale, and is added to the endValue. Hence, the tween is from, say, tranform.position to endValue+transform.position. If startValue is NOT null, then this is an 'absolute' tween, and the tween is from startValue to endValue.

If you DO provide a startValue and it ISN'T the current position/rotation/scale then the GameObject will initially jump to that position/rotation/scale. Note: rotation performed via Eulerangles, scale uses localScale. – the customGameObjectAction is used as a substitute for the built-in Actions for Position, Rotation, or Scale. – For example, one could evaluate a Bezier curve (for Position transforms) or just about anything else.

◆ GetInfoOnAllRunningSequences()

void TilePlus.TpTweener.GetInfoOnAllRunningSequences ( ref List< string > info,
int max )

Ge the ToString for all running sequences.

Parameters
infoOutput list
maxlimit

◆ GetInfoOnAllRunningTweens()

void TilePlus.TpTweener.GetInfoOnAllRunningTweens ( ref List< string > info,
int max )

Get the ToString of all running tweens.

Parameters
infoList of strings to put info into
maxlimit on # of strings

◆ GetSequenceInfo()

string TilePlus.TpTweener.GetSequenceInfo ( long id)

Get the ToString of a sequence without retrieving the instance.

Parameters
idID of the sequence
Returns
string

◆ GetTween()

TpTween? TilePlus.TpTweener.GetTween ( long id)

Get a tween instance. This is a live, running tween.

Parameters
idID of the tween.
Returns
a Tween instance or null

To avoid memory leaks, don't hold an instance of the returned value outside of a method scope. See: CopyTweener and GetTweenInfo. Note that this is ONLY running tweens. To obtain a tween that's in a sequence use GetTweenFromSequence

◆ GetTweenFromSequence()

TpTween? TilePlus.TpTweener.GetTweenFromSequence ( long sequenceId,
long tweenId )

Get a tween with ID from sequence with an Id.

Parameters
sequenceIdId of the sequence
tweenIdId of the tweener
Returns
Tween or null if not found.

◆ GetTweenInfo()

string TilePlus.TpTweener.GetTweenInfo ( long id)

Get the ToString of an ACTIVE tween without retrieving the instance.

Parameters
idID of the tween
Returns
string

◆ HasAnyRunningTweenForTiles()

bool TilePlus.TpTweener.HasAnyRunningTweenForTiles ( TilePlusBase[] tiles)

Is there a running tweens for ANY tile in an array of tiles. Use infrequently, is inefficient (creates ~256 bytes GC).

Parameters
tilesarray of tiles
Returns
true if ANY of the tiles has an associated tween which is running.

◆ HasRunningTweenForTile()

bool TilePlus.TpTweener.HasRunningTweenForTile ( TilePlusBase tile)

Is there a running tween for this tile?

Parameters
tiletile to test
Returns
true if found

◆ HasSequenceForTile()

bool TilePlus.TpTweener.HasSequenceForTile ( TilePlusBase tile,
bool both = true )

Is there a running and/or pending sequence for this tile?

Parameters
tiletile to test
bothif false, just checks running sequences and NOT pending ones.
Returns
true if found

◆ IsRunningTween()

bool TilePlus.TpTweener.IsRunningTween ( long id)

Is a tween with given ID running.

Parameters
id
Returns
true if running

◆ KillRunningSequence()

bool TilePlus.TpTweener.KillRunningSequence ( long sequenceId)

Kill a running sequence given it's sequenceId.

Parameters
sequenceIdID
Returns
false if the sequence found with this ID is null or if the ID doesn't exist.

◆ KillTween()

bool TilePlus.TpTweener.KillTween ( long id)

Kill an ACTIVE tween with a given ID and return the instance to the pool.

Parameters
idID of the tween as returned by QueueTransformTween
Returns
false if the id doesn't match an ACTIVE tween.

The tween is released at the next Update.

◆ OnDisable()

override void TilePlus.TpTweener.OnDisable ( )
virtual

Unity event method.

Reimplemented from TilePlus.ScriptableRuntimeService< T >.

◆ OnEnable()

override void TilePlus.TpTweener.OnEnable ( )
virtual

OnEnable.

Reimplemented from TilePlus.ScriptableRuntimeService< T >.

◆ PendingSequenceAsAwaitable()

Awaitable? TilePlus.TpTweener.PendingSequenceAsAwaitable ( long id)

Convenience method: return a PENDING sequence as as an Awaitable<bool>.

Parameters
idID of sequence. MUST BE A PENDING, NOT RUNNING, SEQUENCE.
Returns
An awaiter for a sequence or null.

There's no way to make a running sequence awaitable. NOTE THAT this will await on either the sequence being PENDING or PLAYING. That way you can create a sequence, make it awaitable, then launch it.

◆ PlaySequence()

bool TilePlus.TpTweener.PlaySequence ( TilePlusBase? parent,
long sequenceId )

Play a sequence.

Parameters
parentParent tile for this sequence.
sequenceIdThe sequence to play. Must already have been created by CreateSequence.
Returns
true if no errors

Note that onRewindOrPingPong and OnUpdate callbacks from the tween are not used.

◆ ResetSequencer()

void TilePlus.TpTweener.ResetSequencer ( )

Reset the sequencer.

◆ ResetTweener()

void TilePlus.TpTweener.ResetTweener ( bool complete = false)

Partial or complete reset of Tweener.

Parameters
completeComplete reset means clearing the starting ID, clearing all tweens and releasing all tweens from the pooler. Normally you don't want to do that so leave it false.

◆ Status()

override string TilePlus.TpTweener.Status ( )
virtual

Status string.

Returns

Reimplemented from TilePlus.ScriptableRuntimeService< T >.

◆ TweenAsAwaitable()

Awaitable? TilePlus.TpTweener.TweenAsAwaitable ( long id)

Convenience method: return a tween as an Awaitable<bool>.

Parameters
idID of tween.
Returns
An awaiter for a tween or null

Property Documentation

◆ Diagnostics

bool TilePlus.TpTweener.Diagnostics = false
getset

Adds additional checks for invalid/insane tweens.

Use TpLibInit to set this at runtime, however that can be overridden at any time.

◆ HasTweensOrSequences

bool TilePlus.TpTweener.HasTweensOrSequences
get

Are there any active tweens or sequences?

◆ NumActiveSequences

int TilePlus.TpTweener.NumActiveSequences
get

How many active sequences?

◆ NumActiveTweens

int TilePlus.TpTweener.NumActiveTweens
get

How many tweens?

◆ SafeMode

bool TilePlus.TpTweener.SafeMode = true
getset

If true, tweens are checked for 'Sanity' before use. 'Sanity' means that the tile parent isn't null and its map isn't null. Setting this false can increase performance if you have many tweens.


The documentation for this class was generated from the following files:
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/Services/Tweener/TpOtherTweens.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/Services/Tweener/TpTweenerData.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/Services/Tweener/TpTweenUpdate.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/Services/Tweener/TpTweener.cs