![]() |
TilePlus Version 5
Unity3D Tilemap Extension
|
Utilities for Tilefab loading. More...
Static Public Member Functions | |
| static async Awaitable< bool > | LoadTileFabsAsync (List< TileFabLoadParams > loadParams, List< TilefabLoadResults > loadResultsList, float intervalBetweenTileFabs=0, float intervalBetweenBundles=0, TpZoneManager? zoneManager=null) |
| Async-Awaitable: Load several tilefabs at once from a list of specifications. | |
| static async Awaitable< TilefabLoadResults?> | LoadTileFabAsync (Tilemap? tileParent, TpTileFab? tileFab, Vector3Int offset, TpTileBundle.TilemapRotation rotation=TpTileBundle.TilemapRotation.Zero, FabOrBundleLoadFlags fabOrBundleLoadFlags=FabOrBundleLoadFlags.NormalWithFilter, Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter=null, Dictionary< string, Tilemap >? targetMap=null, TpZoneManager? zoneManagerInstance=null, float intervalBetweenBundles=0) |
| Async Awaitable version - Load one or more tilemaps and associated prefabs, if any. ONLY difference is intervalBetweenBundles parameter, used to delay between bundle loads. IF a TileFab has only one bundle there's no need to use this. IF you set intervalBetweenBundles < .10 then there's no need to use this. | |
| static ? TilefabLoadResults | LoadTileFab (Tilemap? tileParent, TpTileFab? tileFab, Vector3Int offset, TpTileBundle.TilemapRotation rotation=TpTileBundle.TilemapRotation.Zero, FabOrBundleLoadFlags fabOrBundleLoadFlags=FabOrBundleLoadFlags.NormalWithFilter, Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter=null, Dictionary< string, Tilemap >? targetMap=null, TpZoneManager? zoneManagerInstance=null) |
| Non- async-Awaitable version: Load one or more tilemaps and associated prefabs, if any. | |
| static Dictionary< Vector3Int, string >? List< GameObject > loadedPrefabs | LoadBundle (TpTileBundle tileBundleAsset, Tilemap map, Vector3Int offset, TpTileBundle.TilemapRotation rotation=TpTileBundle.TilemapRotation.Zero, FabOrBundleLoadFlags fabOrBundleLoadFlags=FabOrBundleLoadFlags.NormalWithFilter, Func< FabOrBundleFilterType, BoundsInt, object, bool >? filter=null, RectInt? zoneLocator=null) |
| static ? Tilemap | FindTilemap (TpTileFab.AssetSpec spec) |
| static bool | GetTileFabFromGuid (string guid, out TpTileFab? fab) |
| Get a TileFab instance from a GUID string. | |
| static bool | EnableZoneManagers (bool enable=true, int initialNumManagers=1, int guidTableSize=128, Dictionary< string, TpTileFab >? stringToFabMap=null) |
| Enable/Disable the Zone Manager subsystem. | |
| static bool | CreateZoneManagerInstance (out TpZoneManager? instance, string iName, Dictionary< string, Tilemap > targetMap) |
| Create a ZM instance or get an existing one. | |
| static bool | HasNamedInstance (string iName) |
| Does the named ZoneLayout controller instance exist? | |
| static bool | DeleteNamedInstance (string iName, bool disableWhenNone=true) |
| Delete a named ZoneLayout controller instance. | |
| static bool | GetNamedInstance (string iName, out TpZoneManager? instance) |
| Get a named ZoneLayout controller instance. | |
| static bool | RemapTileGuid (Guid oldGuid, out Guid newGuid) |
| Attempt to remap a GUID. | |
| static bool | RemoveFromGuidLookup (Guid alias) |
| Delete from the loadedGuidLookup when you are not using the built-in system. It's important to remove these when you are deleting a TileFab or you'll have a memory leak;. | |
| static void | UpdateGuidLookup (ZoneReg oldReg, ZoneReg newReg) |
| Update the GUID lookup. Used to alias previously-used TPT tile GUIDs to new TPT tile GUIDs. | |
| static bool | AddGuidLookup (Guid original, Guid alias) |
| Add to the loadedGuidLookup so that TpLib's Guid-to-tile lookup works. This is only for use if you aren't using the built-in system. | |
| static bool | RemoveGuidLookup (BundleGuidMap bundleGuidMap) |
| Remove a GUID lookup. Used when deleting a ZoneReg. | |
| static void | AddChunkedBundle (TpTileBundle chunkedBundle) |
| Add a chunked Bundle to an internal list. | |
| static void | RemoveChunkedBundle (TpTileBundle unchunkedBundle) |
| Remove a chunked Bundle from the internal list. | |
Static Public Attributes | |
| static Dictionary< Vector3Int, string > | posToGuidMap |
| Load the contents of a Bundle asset to a tilemap. Note: assumes tilemap is at 0,0,0. If not, adjust offset prior to call. | |
Properties | |
| static ulong | RegistrationIndex [get] |
| Gets the current, unused registration index. | |
| static bool | AnyActiveZoneManagers [get] |
| Any Zone Manager instances? | |
| static int | NumZoneManagerInstances [get] |
| how many active zone managers | |
| static bool | ZoneManagerCreationEnabled [get] |
| Is the creation of Zone Manager instances enabled? | |
| static int | NumZoneManagerChunks [get] |
| how many chunks are being managed by ALL zone managers. | |
Utilities for Tilefab loading.
|
static |
Add a chunked Bundle to an internal list.
| chunkedBundle |
|
static |
Add to the loadedGuidLookup so that TpLib's Guid-to-tile lookup works. This is only for use if you aren't using the built-in system.
| original | Previous Guid from when the game state was saved |
| alias | alias Guid from TileFab loading's guid change operation or elsewhere |
|
static |
Create a ZM instance or get an existing one.
| instance | out param gets the instance |
| iName | unique name. If already used, fetches existing ZM instance |
| targetMap | Tilemaps to be controlled by this ZM |
|
static |
Delete a named ZoneLayout controller instance.
| iName | the unique name for the ZoneLayout |
| disableWhenNone | Auto-shutoff zone management when there are no more ZMs |
|
static |
Enable/Disable the Zone Manager subsystem.
| enable | on/off |
| initialNumManagers | best guess at # of managers required |
| guidTableSize | best guess at GUID translation table size |
| stringToFabMap | Optional map from string to TpTileFab. If omitted, it's created here. |
Note that TileFabs might have to be in Resource Folders to be found since they're only referred to by GUIDs - unless you create a ScriptableObject parented to some GameObject component so that the TileFabs are included in a build.
The bundle data cache can be used when reusing the same TileFabs and Bundles repeatedly AND new GUIDs are NOT required. Useful for the 'chunk streaming' mode of operation when using Zone Managers and Zone Layout when the GUIDs of the tiles aren't modified. NOTE that GUID remapping is ignored when using this feature.
|
static |
Find a tilemap given an asset spec from a TileFab
| spec | The Asset Spec from a TileFab |
|
static |
Get a named ZoneLayout controller instance.
| iName | the unique name for the ZoneLayout |
| instance | an out param for the instance |
|
static |
Get a TileFab instance from a GUID string.
| guid | GUID string |
| fab | TileFab instance. Null if not found |
|
static |
Does the named ZoneLayout controller instance exist?
| iName | the unique name for the ZoneLayout |
|
static |
|
static |
Non- async-Awaitable version: Load one or more tilemaps and associated prefabs, if any.
| tileParent | the parent of the calling tile (if any, can be null if not a tile) |
| tileFab | a TpTileFab asset |
| offset | optional offset from tiles' stored positions |
| rotation | optional rotation (not implemented) |
| fabOrBundleLoadFlags | Flags from the LoadFlags enum. |
| filter | a Func of returning a bool. See also LoadBundle. |
| targetMap | A dictionary mapping tilemap names as found in the TileFab to actual Tilemap instances. Used to override the names from the Tilefab. Case-sensitive. It's also much faster than a name lookup as done without a provided mapping. |
| zoneManagerInstance | If using TpZoneManager, pass its instance. |
Does not support chunkify flag in the fabOrBundleLoadFlags
|
static |
Async Awaitable version - Load one or more tilemaps and associated prefabs, if any. ONLY difference is intervalBetweenBundles parameter, used to delay between bundle loads. IF a TileFab has only one bundle there's no need to use this. IF you set intervalBetweenBundles < .10 then there's no need to use this.
| tileParent | the parent of the calling tile (if any, can be null if not a tile) |
| tileFab | a TpTileFab asset |
| offset | optional offset from tiles' stored positions |
| rotation | optional rotation (not implemented) |
| fabOrBundleLoadFlags | Flags from the LoadFlags enum. |
| filter | a Func of returning a bool. See also LoadBundle. |
| targetMap | A dictionary mapping tilemap names as found in the TileFab to actual Tilemap instances. Used to override the names from the Tilefab. Case-sensitive. It's also much faster than a name lookup as done without a provided mapping. |
| zoneManagerInstance | If using TpZoneManager, pass its instance. |
| intervalBetweenBundles | wait time between each Bundle of a TileFab. Range is 0.01f - 0.1f (seconds). If 0 (default value) then there are no delays between Bundle loads. |
|
static |
Async-Awaitable: Load several tilefabs at once from a list of specifications.
| loadParams | A list of TileFabLoadParams |
| loadResultsList | if not null, TileFab LoadResults added to list. Note it is NOT cleared here. |
| intervalBetweenTileFabs | wait time between each TileFab. Range is 10-500 MSEC. If 0 (default value) then there are no delays between TileFab loads |
| intervalBetweenBundles | wait time between each Bundle of a TileFab. Range is .01f - 0.1f (Seconds). If 0 (default value) then there are no delays between Bundle loads. |
| zoneManager | the ZoneManager instance, if you're using it. |
|
static |
Attempt to remap a GUID.
| oldGuid | the old one |
| newGuid | the remapped one |
|
static |
Remove a chunked Bundle from the internal list.
| unchunkedBundle |
|
static |
Delete from the loadedGuidLookup when you are not using the built-in system. It's important to remove these when you are deleting a TileFab or you'll have a memory leak;.
| alias | The current Guid for a tile |
|
static |
Update the GUID lookup. Used to alias previously-used TPT tile GUIDs to new TPT tile GUIDs.
| oldReg | the previously-used (saved) reg |
| newReg | the new reg, with new GUIDs, after loading |
|
static |
Load the contents of a Bundle asset to a tilemap. Note: assumes tilemap is at 0,0,0. If not, adjust offset prior to call.
NOTE that TpTileBundles do NOT create AssetRegistration entries, ONLY calling LoadTileFab does that.
| tileBundleAsset | the asset reference |
| map | target Tilemap |
| offset | offset to position |
| rotation | optional rotation (unsupported) |
| fabOrBundleLoadFlags | Flags from the LoadFlags enum. |
| filter | Func of returning a bool. The filter should return true if the tile/prefab is acceptable or false to omit it. |
| zoneLocator | If not null, used instead of Bundle's m_TilemapBoundsInt |
map.SetTiles(tileChangeData) is used: flags are not restored. When the tiles are started, the tiles' flags are used. Also, lock flags on the tilemap are ignored.
|
staticget |
Any Zone Manager instances?
|
staticget |
how many chunks are being managed by ALL zone managers.
|
staticget |
how many active zone managers
|
staticget |
Gets the current, unused registration index.
|
staticget |
Is the creation of Zone Manager instances enabled?