A reference to the Game instance this plugin is running under.
The key under which this plugin was installed into the Scene Systems.
This property is only set when the plugin is instantiated and added to the Scene, not before.
You can use it during the boot
method.
A handy reference to the Plugin Manager that is responsible for this plugin. Can be used as a route to gain access to game systems and events.
A reference to the Scene that has installed this plugin.
Only set if it's a Scene Plugin, otherwise null
.
This property is only set when the plugin is instantiated and added to the Scene, not before.
You can use it during the boot
method.
A reference to the Scene Systems of the Scene that has installed this plugin.
Only set if it's a Scene Plugin, otherwise null
.
This property is only set when the plugin is instantiated and added to the Scene, not before.
You can use it during the boot
method.
Phaser.Scene lifecycle event
Load a navmesh from Tiled. Currently assumes that the polygons are squares! Does not support tilemap layer scaling, rotation or position.
Key to use when storing this navmesh within the plugin.
The ObjectLayer from a tilemap that contains the polygons that make up the navmesh.
The amount (in pixels) that the navmesh has been shrunk around obstacles (a.k.a the amount obstacles have been expanded)
This method attempts to automatically build a navmesh based on the give tilemap and tilemap layer(s). It attempts to respect the x/y position and scale of the layer(s). Important note: it doesn't support rotation/flip or multiple layers that have different positions/scales. This method is a bit experimental. It will generate a valid mesh, but it won't necessarily be optimal, so you may end up sometimes getting non-shortest paths.
Key to use when storing this navmesh within the plugin.
The tilemap to use for building the navmesh.
An optional array of tilemap layers to use for building the mesh.
An optional function to use to test if a tile is walkable. Defaults to assuming non-colliding tiles are walkable.
Amount to "shrink" the mesh away from the tiles. This adds more polygons to the generated mesh, but can be helpful for preventing agents from getting caught on edges. This supports values between 0 and tileWidth/tileHeight (whichever dimension is smaller).
Phaser.Scene lifecycle event - will destroy all navmeshes created.
Phaser.Scene lifecycle event - noop in this plugin, but still required.
Remove all the meshes from the navmesh.
Remove the navmesh stored under the given key from the plugin. This does not destroy the navmesh.
Phaser.Scene lifecycle event - noop in this plugin, but still required.
The PluginManager calls this method on a Global Plugin when the plugin is stopped.
The game code has requested that your plugin stop doing whatever it does.
It is now considered as 'inactive' by the PluginManager.
Handle that process here (i.e. stop listening for events, etc)
If the plugin is started again then BasePlugin.start
will be called again.
On a Scene Plugin, this method is never called.
Generated using TypeDoc
This class can create navigation meshes for use in Phaser 3. The navmeshes can be constructed from convex polygons embedded in a Tiled map. The class that conforms to Phaser 3's plugin structure.