![]() |
TilePlus Version 5
Unity3D Tilemap Extension
|
Pooled spawner for TilePlus system. More...


Public Types | |
| enum | PositioningMode { UseAssetSetting , AtTilePosition , AtContactPosition , RandomInZone } |
| Enum PositioningMode. More... | |
| enum | TileParentingMode { SameParentAsTile , ParentByReference , ParentByTag , ParentByName } |
| How to parent painted tiles. More... | |
Public Member Functions | |
| override string | Status () |
| The TilePlus SysInfo window will show all SRS 'Status' strings when playing in-editor (if the 'show' checkbox is checked). This is totally optional. | |
| override bool | CanPollForDetails () |
Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.
| |
| override string | Details (int limit=-1) |
| Get a string with the pool status. | |
| override void | OnEnable () |
| OnEnable. | |
| override void | OnDisable () |
| Unity event method. | |
| void | ResetPools () |
| Reset all prefab pools. V3.1 and later: also clears collidableGO hashset. | |
| bool | IsPreloaded (GameObject prefab) |
| has this prefab already been preloaded? | |
| void | Preload (GameObject? prefab, int quantity) |
| Preload a pool. | |
| void | DespawnPrefab (int sourcePrefabId, GameObject? target) |
| Despawn a prefab into the pool. | |
| GameObject? | SpawnPrefabFromTile (TilePlusPrefabSpawnerItem spawnerItem, TilePlusBase tile, Transform? altParent, bool keepWorldPosition) |
| Spawn a single prefab from a tile that implements the ISpawner interface. | |
| GameObject? | SpawnPrefab (GameObject? prefab, Vector3 position, Transform? parentTransform=null, string parentNameOrTag="", bool searchForTag=false, bool keepWorldPosition=true) |
| Spawn a single prefab. Always uses pooling. | |
| TilePlusBase? | PaintTile (PaintingSpec? item, TilePlusBase sourceTile, Tilemap? paintTarget, TilePaintPosition paintPos=TilePaintPosition.None) |
| Paint a tile from the TpTileList asset by index. Note that null is returned if the position is occupied. Also, you can change the tilemap to use for painting with the m_PaintingTilemap field in-editor or via code. | |
| bool | IsCollidable (GameObject go) |
| Returns true if a spawned GO is a collidable. | |
| bool | TestCollidable (GameObject go) |
| Test for colliders. | |
| Tilemap? | GetPaintingTilemap (TileParentingMode parentingMode, string mapNameOrTag, string info) |
| Get the tilemap for painting. | |
| Public Member Functions inherited from TilePlus.ScriptableRuntimeService< T > | |
| override string | ToString () |
| Customize ToString in overrides. | |
| Public Member Functions inherited from TilePlus.IScriptableService | |
| void | Update (float deltaTime) |
| Update implementation: Must override with explicit implementation. | |
| void | MessageTarget (ObjectPacket packet) |
| If Accepts messages is true, reimplement this to get messaged. | |
Properties | |
| string | PoolHostName [get] |
| Gets the name of the pool host. | |
| string | CleanPoolHostName [get] |
| Get the pool host name with no advice. | |
| int | NumPooledPrefabs [get] |
| total Number of pooled prefabs | |
| int | NumCollidables [get] |
| Total number of Collidables. | |
| GameObject[] | AllCollidableSpawnedPrefabs [get] |
| Get an array of all Collidables. Note: uses LINQ and may generate some GC. | |
| 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. | |
| bool | WantsUpdate [get] |
| Does this SRS want an update tick? MUST override if you're providing an Update method. MUST override with explicit implementation. | |
| bool | ReadyForUpdate [get] |
| Is this SRS ready for an update? MUST Override if your SRS doesn't always need an update. MUST override with explicit implementation. | |
| string[] | AcceptableMessages [get] |
| If true, can accept ObjectPacket messages from the Service Manager with command-strings matching those returned here. | |
Events | |
| Action< GameObject, GameObject >? | OnCollidableObjectSpawned |
| This event fires when a GO is spawned AND it has a collider. First GO is what was spawned. Second GO is the source prefab To be deemed Collidable it needs to have a TpSpawnlink component on the main (root) GO, the IgnoreCollider flag must be false, and either a Collider or Collider2D component. | |
| Action< GameObject >? | OnCollidableObjectDespawned |
| This event fires when a GO is despawned AND it has or had a collider. GameObject is what's being despawned To be deemed Collidable it needs to have a TpSpawnlink component on the main (root) GO, the IgnoreCollider flag must be false, and either a Collider or Collider2D component. | |
Additional Inherited Members | |
| Static Protected Member Functions inherited from TilePlus.ScriptableRuntimeService< T > | |
| static void | Create () |
| Create and initialize method. | |
Pooled spawner for TilePlus system.
Enum PositioningMode.
|
virtual |
Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
| void TilePlus.TpSpawner.DespawnPrefab | ( | int | sourcePrefabId, |
| GameObject? | target ) |
Despawn a prefab into the pool.
| sourcePrefabId | Instance Id of source prefab |
| target | the instantiated prefab |
If the sourcePrefabId isn't found in m_Pools then the target is Destroyed.
|
virtual |
Get a string with the pool status.
| limit | Limit the number of pools shown |
returns>A string with the Pools' status
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
| Tilemap? TilePlus.TpSpawner.GetPaintingTilemap | ( | TileParentingMode | parentingMode, |
| string | mapNameOrTag, | ||
| string | info ) |
Get the tilemap for painting.
| parentingMode | search by tag,name,etc |
| mapNameOrTag | search string |
| info | will print this if an error/warning/log |
| bool TilePlus.TpSpawner.IsCollidable | ( | GameObject | go | ) |
Returns true if a spawned GO is a collidable.
| go | GameObj to test |
If the prefab adds or removes a collider AFTER it is spawned then using this test is useless.
| bool TilePlus.TpSpawner.IsPreloaded | ( | GameObject | prefab | ) |
has this prefab already been preloaded?
| prefab | prefab to test |
|
virtual |
Unity event method.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
|
virtual |
OnEnable.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
| TilePlusBase? TilePlus.TpSpawner.PaintTile | ( | PaintingSpec? | item, |
| TilePlusBase | sourceTile, | ||
| Tilemap? | paintTarget, | ||
| TilePaintPosition | paintPos = TilePaintPosition::None ) |
Paint a tile from the TpTileList asset by index. Note that null is returned if the position is occupied. Also, you can change the tilemap to use for painting with the m_PaintingTilemap field in-editor or via code.
| item | Painting spec for the tile to paint |
| sourceTile | A tile instance that implements the ISpawner interface. |
| paintTarget | Target tilemap. If it's the same as the sourceTile's map and paint position ends up being the same as the sourceTile position then nothing is painted. |
| paintPos | None, use paintPos from tile asset, else overrides tile spec. |
| System.ArgumentOutOfRangeException |
If paintPos from asset is None then use a random position, if paintPos from asset is Top then if the target tilemap is different than this tile's parent then use the same grid position as this tile.
| void TilePlus.TpSpawner.Preload | ( | GameObject? | prefab, |
| int | quantity ) |
Preload a pool.
| prefab | Prefab to preload |
| quantity | how many instances to preload |
| void TilePlus.TpSpawner.ResetPools | ( | ) |
Reset all prefab pools. V3.1 and later: also clears collidableGO hashset.
Pools are cleared, which Destroys the pooled prefabs. Any prefabs that have been taken from the pool BUT are NOT released to the pool will NOT be destroyed.
| GameObject? TilePlus.TpSpawner.SpawnPrefab | ( | GameObject? | prefab, |
| Vector3 | position, | ||
| Transform? | parentTransform = null, | ||
| string | parentNameOrTag = "", | ||
| bool | searchForTag = false, | ||
| bool | keepWorldPosition = true ) |
Spawn a single prefab. Always uses pooling.
| prefab | the prefab asset reference |
| position | world position to spawn at |
| parentTransform | Parent transform - can be null |
| parentNameOrTag | Name or tag of parent if Transform is null |
| searchForTag | If transform is null AND parentNameOrTag isn't empty, search for tag if this is true, otherwise search for name |
| keepWorldPosition | Keep world position relative to parent if one is provided or located via name or tag. See Transform.SetParent |
If parent is NULL and parentNameOrTag is not an empty string then a parent is searched for by tag or name depending on value of searchForTag. If no parent is found then spawned item is not parented or remains parented to TppPoolHost. If that's what you want, leave parent=null and parentNameOrTag=string.Empty
| GameObject? TilePlus.TpSpawner.SpawnPrefabFromTile | ( | TilePlusPrefabSpawnerItem | spawnerItem, |
| TilePlusBase | tile, | ||
| Transform? | altParent, | ||
| bool | keepWorldPosition ) |
Spawn a single prefab from a tile that implements the ISpawner interface.
| spawnerItem | item from the prefab list |
| tile | A tile instance that implements the ISpawner interface |
| altParent | if null, uses info from asset |
| keepWorldPosition | Keep world position relative to parent if using altParent. See Transform.SetParent |
| System.ArgumentOutOfRangeException |
Will log an error if tile does not implement ITpSpawnUtilClient
|
virtual |
The TilePlus SysInfo window will show all SRS 'Status' strings when playing in-editor (if the 'show' checkbox is checked). This is totally optional.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
| bool TilePlus.TpSpawner.TestCollidable | ( | GameObject | go | ) |
Test for colliders.
| go | GameObject |
|
get |
Get an array of all Collidables. Note: uses LINQ and may generate some GC.
|
get |
Get the pool host name with no advice.
|
get |
Total number of Collidables.
|
get |
total Number of pooled prefabs
The number of pooled prefabs.
|
get |
Gets the name of the pool host.
The name of the pool host.
| Action<GameObject>? TilePlus.TpSpawner.OnCollidableObjectDespawned |
This event fires when a GO is despawned AND it has or had a collider. GameObject is what's being despawned To be deemed Collidable it needs to have a TpSpawnlink component on the main (root) GO, the IgnoreCollider flag must be false, and either a Collider or Collider2D component.
| Action<GameObject, GameObject>? TilePlus.TpSpawner.OnCollidableObjectSpawned |
This event fires when a GO is spawned AND it has a collider. First GO is what was spawned. Second GO is the source prefab To be deemed Collidable it needs to have a TpSpawnlink component on the main (root) GO, the IgnoreCollider flag must be false, and either a Collider or Collider2D component.