Skip to main content

Zone-Based

AnimZoneBaseAnimZoneLoader

This is a base-class TPT tile that can be used for defining a trigger area. Its purpose is to define an area on the Tilemap, specifically, a BoundsInt. Since it’s a subclass of TpFlexAnimatedTile,TpFlexAnimated tile and inherits its spritefields canand beeditor animated. If you don’t desire animation, just don’t add a SpriteAnimationClipSet.appearance.

SettingIt’s used to load archived Tilemaps from TpTileFab assets, which are created by the zoneTools/TilePlus/Prefabs/Bundle sizeTilemaps workscommand.

in

IMPORTANT

one

It's ofsomewhat twoobsoleted ways, depending on the settingbecause of the ModifySpriteLayout toggle. In either case, the ZonePositionAndSize fields let you move the position of the zonesystem and the size of the zone.

If ModifySprite is checkedNOT (on),compatible thenwith as you change the area positioning and size, the tile’s sprite is transformed to encompass the trigger area. Since the tile controls the transform, transform modification in the TilePlusBase section of the inspector is unavailable. The VisualizeSprite button will highlight the boundary of the zone for a few seconds when clicked.

If ModifySprite is not checked (off), then the sprite isn’t modified as you change the zone size. The VisualizeArea button creates a persistent outline around the zone. The outline will be cleared if you click VisualizeOff or change the selection.it.

Public fields:

  • TileSpriteClear:Loading ClearOffset: the spritelocation when painted, whenwhere the gameTileFab runs,will both,be placed.
  • Preview: preview the TileFab at the Loading Offset.
  • TileFab: A TileFab archive from a Project folder.
  • UseZoneManager: Optionally use a Zone Manager for detection of already loaded TileFabs.
  • ShowOffsetPositionGizmo: show a marquee at the

Zone Managers and their uses are discussed here.

More about Preview

Preview loads the tiles into a preview tilemap or notmaps, atif all.there are multiple TpTileBundle assets referenced by the TpTileFab asset. The default for this tilepreview is ClearOnStart.active Noteuntil you click Preview again or the Editor’s Selection changes. When preview is active, you can change the loading offset and the preview area will change position.

Loading or previewing tiles depends on there being compatible Tilemaps that are named or tagged in such a way that the spritesystem willcan beidentity invisible,which andTilemap to use. This information is embedded in the TileFab asset when you won’tcreate beit. ableIf you need to seechange it just edit the triggerasset’s areaTileAssets ifsection thisin isthe setProject window.

The tile does not automatically load Tilemaps at runtime. Rather, you send a message to ClearInSceneViewit or ClearInSceneViewAndOnStart.

  • Position, Size: Adjustvia the positionTpLib andSendMessage sizemethods. ofAs configured, it expects the boundariesmessage ofto thecontain Triggera zone.Vector3Int Unavailabledescribing whena Lock All is checked.
  • ModifySprite: Controls whether the tile’s sprite is affected by zone size changes.
  • UseTrigger:position. If this is true then the tile’s MessageTarget (see TpLib.SendMessage) method will trigger an event if the passed-in position is within the TriggerZone zone. Note thatbounds, the displaytile ofuses thisTpLib’s fieldPostTileEvent may be inhibited in subclasses, e.g., TpAnimZoneLoader.
  • Lock Position and Size: Prevent changesmethod to X, Y, or Z position or Z size; or Lock All. (Editor-only).
  • Public properties:

    • ZoneBoundsInt: Get or Set the BoundsInt which describes the trigger area.
    • ZoneBounds: Get a Bounds based on ZoneBoundsInt.

    Note that the bounds size can never be less than 1,1,1.

    If you change the size of the sprite and there’s another tile in the same area it might be obscured by the transformed sprite (or vice versa). If that’s a problem, you can adjust the transparency in the Color field (TilePlusBase section of the Selection Inspector) or change the Tilemap Renderer’s Sort Order setting.

    Plugins/TilePlus/Runtime/Textures/TriggerZoneSprite can be used for the sprite for this tile, but you can use any sprite. Note that the sprite won’t appear if you change the TileSpriteClear to Clear In Scene View. If you don’t want the trigger zone to appear in Play mode, set TileClearMode to Clear On Start.

    The other action button for this tile is Reset Zone. Reset Zone does what you’d expect and resets the boundary to one tile space. This button does not appear when the LockAll toggle is checked.

    At runtime, this tile is completely passive aside from animation. But with TpLib you can, for example, get a reference to every tile of this Type and use the trigger zones to do something when a playable entity enters or leavespost a trigger zone. It’s very general-purpose, but how you use it is naturally bespoke to your own project. However, one common case might be to load more tiles to open a new area. That leads us to TilePlusAnimZoneLoader, a subclass that embeds information used to load TileFabs.event.

    Note that the Tilemap Renderer will sometimes cull enlarged sprites. There’s a FAQ in the User Guide regarding this.

    ZoneBase

    AnimZoneLoader

    AnimZoneSpawner

    ZoneAnimator