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

A specialized ChunkSelector that uses the Chunkified data in Bundles to fill in empty areas in the ZoneLayout. More...

Inheritance diagram for TilePlus.TpChunkZoneSelector:
Collaboration diagram for TilePlus.TpChunkZoneSelector:

Public Member Functions

override bool Initialize (TpZoneManager zm, object? obj=null)
 Initialization.
Parameters
zmThe Zone Manager this Selector is using
objArbitrary data
Returns
true if XXXX, false otherwise.

override TileFabLoadParams Selector (RectInt locator, TpZoneLayout layout, Dictionary< string, Tilemap > monitoredMaps)
 Obtain TileFab load params given a locator.
override bool Release ()
 Release memory in the TileFab and its bundles.
void OnDisable ()
 Unity event handler.
override BoundsInt SelectorTotalSize (TpZoneLayout layout)
 selectorTotalSize BoundsInt defines the size of a single complete image ie the entirety of the template's TileFabs. by default this is placed in Quadrant 1 of a 2D plane whose origin is at m_Layout.m_WorldOrigin and the size is always a square.
override List< TemplateSelectorQueryResults< T > > GetTilePlusTilesOfType< T > (Func< T, string, bool >? filter=null, int size=16, object? options=null)
 —A GENERIC METHOD— Access ALL the TileFab's bundles to create a list of a particular type of TPT tile, with filtering. Intended to be used during a scene or game init as this can take a while, depending on how many bundles are in the TileFab and how many TPT tiles are in each bundle.
Public Member Functions inherited from TilePlus.TpChunkSelectorBase
virtual void OnEnable ()
 OnEnable handler: add a GUID if not present. Typically this occurs when the SO is created from Unity's Create Asset menu.
void AddGuid ()
 Add/Change GUID for this asset.

Public Attributes

TpTileFabm_TileFabSource = null
 Scene TileFab.
bool m_ClearFabCache = true
 Auto clear this Fab's cache when the selector isn't used anymore.
Public Attributes inherited from TilePlus.TpChunkSelectorBase
FabOrBundleLoadFlags m_LoadFlags = FabOrBundleLoadFlags.NormalWithFilter
 Load flags to use.

Properties

override List< TpTileFabUsedTileFabs [get]
 return just this single TileFab
List< RectInt >? AllLocators [get]
 Get all of the locators for this Selector.
Properties inherited from TilePlus.TpChunkSelectorBase
virtual ? List< TpTileFabUsedTileFabs [get]
 A list of the TileFabs used by this selector. If not appropriate, return null.
int ChunkSize [get, set]
 The chunk size used by this selector.
Guid SelectorGuid [get]
 A GUID for this selector.
string AssetGuidString [get]
 GUID as string.
Properties inherited from TilePlus.IChunkSelector
FabOrBundleLoadFlags LoadFlags [get]
 Default load flags. Override in derived class.

Detailed Description

A specialized ChunkSelector that uses the Chunkified data in Bundles to fill in empty areas in the ZoneLayout.

Member Function Documentation

◆ GetTilePlusTilesOfType< T >()

override List< TemplateSelectorQueryResults< T > > TilePlus.TpChunkZoneSelector.GetTilePlusTilesOfType< T > ( Func< T, string, bool >? filter = null,
int size = 16,
object? options = null )
virtual

—A GENERIC METHOD— Access ALL the TileFab's bundles to create a list of a particular type of TPT tile, with filtering. Intended to be used during a scene or game init as this can take a while, depending on how many bundles are in the TileFab and how many TPT tiles are in each bundle.

Parameters
optionsOptional object for custom implementations.
filteroptional filter using the tile ASSET and name of Tilemap as input params, returning a bool. If that bool is false then the tile is excluded from the method's output.
sizeoptional initial allocated size of returned list
Template Parameters
TType of tile.
Returns
List of TemplateSelectorQueryResults

retrieves TilePlus tiles ONLY. It's important to note that:

  1. the tile returned is a locked TilePlus tile ASSET in the PROJECT and not an INSTANCE in the scene. 1.A. So don't mess with it. Reading the contents of fields is A-OK.
  2. Only the string name of the Tilemap (as preserved in the TileFab) is available.
  1. The bundles aren't unarchived, the locked TilePlus tile assets are examined directly, which is why one sees expressions like item.m_TilePosition.m_Position.
  2. In general it's a bad idea to maintain references to these tiles; doing so will cause a memory leak. So don't cache the TemplateSelectorQueryResults outside of the calling method.

Reimplemented from TilePlus.TpChunkSelectorBase.

◆ Initialize()

override bool TilePlus.TpChunkZoneSelector.Initialize ( TpZoneManager zm,
object? obj = null )
virtual

Initialization.

Parameters
zmThe Zone Manager this Selector is using
objArbitrary data
Returns
true if XXXX, false otherwise.

Reimplemented from TilePlus.TpChunkSelectorBase.

◆ OnDisable()

void TilePlus.TpChunkZoneSelector.OnDisable ( )

Unity event handler.

◆ Release()

override bool TilePlus.TpChunkZoneSelector.Release ( )
virtual

Release memory in the TileFab and its bundles.

Returns
false for error.

Reimplemented from TilePlus.TpChunkSelectorBase.

◆ Selector()

override TileFabLoadParams TilePlus.TpChunkZoneSelector.Selector ( RectInt locator,
TpZoneLayout layout,
Dictionary< string, Tilemap > monitoredMaps )
virtual

Obtain TileFab load params given a locator.

Parameters
locatorThe Locator.
layoutThe Zone Layout instance.
monitoredMapsTilemaps used by the ZoneManager.
Returns
TileFab load params

Reimplemented from TilePlus.TpChunkSelectorBase.

◆ SelectorTotalSize()

override BoundsInt TilePlus.TpChunkZoneSelector.SelectorTotalSize ( TpZoneLayout layout)
virtual

selectorTotalSize BoundsInt defines the size of a single complete image ie the entirety of the template's TileFabs. by default this is placed in Quadrant 1 of a 2D plane whose origin is at m_Layout.m_WorldOrigin and the size is always a square.

Parameters
layoutThe layout to use
Returns
BoundsInt

Reimplemented from TilePlus.TpChunkSelectorBase.

Member Data Documentation

◆ m_ClearFabCache

bool TilePlus.TpChunkZoneSelector.m_ClearFabCache = true

Auto clear this Fab's cache when the selector isn't used anymore.

◆ m_TileFabSource

TpTileFab? TilePlus.TpChunkZoneSelector.m_TileFabSource = null

Scene TileFab.

Property Documentation

◆ AllLocators

List<RectInt>? TilePlus.TpChunkZoneSelector.AllLocators
get

Get all of the locators for this Selector.

◆ UsedTileFabs

override List<TpTileFab> TilePlus.TpChunkZoneSelector.UsedTileFabs
get

return just this single TileFab

Implements TilePlus.IChunkSelector.


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