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

-—BASE CLASS-— This is used by TpZoneAnimator to provide customization. More...

Inheritance diagram for TilePlus.TpAnimatorAction:
Collaboration diagram for TilePlus.TpAnimatorAction:

Public Member Functions

void OnEnable ()
 OnEnable calls Init if m_InitOnEnable is true.
virtual bool Init (object? obj=null)
 Do any required initialization.
virtual bool Exec (TpZoneAnimator? zoneAnimator)
 Do something.

Public Attributes

bool m_ActionHandlesSpawnDespawn
 If true, this action handles Spawning and the TpZoneAnimator tile doesn't spawn. Note that the action will see animator and target == null in the Exec method.
bool m_InitOnEnable
 If true, Init is executed in OnEnable.

Properties

bool Initialized [get]
 Has this instance been initialized?

Detailed Description

-—BASE CLASS-— This is used by TpZoneAnimator to provide customization.

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

Member Function Documentation

◆ Exec()

virtual bool TilePlus.TpAnimatorAction.Exec ( TpZoneAnimator? zoneAnimator)
virtual

Do something.

Parameters
zoneAnimatorA ref to the tile that is the caller of this method
Returns
pass/fail

zoneAnimator.target is the prefab game object. Don't use Tilemap.GetInstantiatedObject

If m_ActionHandlesSpawnDespawn then zoneAnimator.PrefabAnimator and zoneAnimator.Target (the spawned GO) will be null on entry. Normally that'd only occur for a Start action.

NOTE that any prefabs spawned here should parented to a Tilemap AND should be added to the ZoneAnimator instance's SpawnedPrefabs list by using zoneAnimator.AddSpawnedGameObject(); If you use the base class' Spawn method (recommended if this prefab is the one you want animated) this is handled automatically.

If no prefabs are spawned in the ZoneAnimator, ensure that SetTarget is used on the ZoneAnimator for at least one animator.

◆ Init()

virtual bool TilePlus.TpAnimatorAction.Init ( object? obj = null)
virtual

Do any required initialization.

Returns

◆ OnEnable()

void TilePlus.TpAnimatorAction.OnEnable ( )

OnEnable calls Init if m_InitOnEnable is true.

Member Data Documentation

◆ m_ActionHandlesSpawnDespawn

bool TilePlus.TpAnimatorAction.m_ActionHandlesSpawnDespawn

If true, this action handles Spawning and the TpZoneAnimator tile doesn't spawn. Note that the action will see animator and target == null in the Exec method.

◆ m_InitOnEnable

bool TilePlus.TpAnimatorAction.m_InitOnEnable

If true, Init is executed in OnEnable.

Property Documentation

◆ Initialized

bool TilePlus.TpAnimatorAction.Initialized
get

Has this instance been initialized?


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