AgentDestroyer

AgentDestroyer

Destroys agents that interact with this cell, operating in one of two modes depending on whether a color is configured.

  • Passive mode (color is NONE): destroys any non-player agent the moment it steps onto this cell, removing it from the cell it entered from.
  • Active mode (color is set): destroys the agent currently on this cell when a matching color event is received.

Typical use: create invisible kill-zones for agents, or trigger a boss defeat remotely via a color event.

Constructor

new AgentDestroyer(terrain, color)

Source:
Parameters:
Name Type Description
terrain Terrain

The underlying terrain this decorator wraps.

color Color

The color event that triggers agent removal in active mode. Pass NONE for passive mode.

Extends

Classes

AgentDestroyer

Members

terrain :Terrain

Source:
Overrides:
Type:

Methods

getProxiedTerrain()

Description:
  • Return the terrain being wrapped (TerrainProxy interface).

Source:
Overrides:

onAgentEnterInternal(_event, agent, cell, dir)

Description:
  • In passive mode (color is NONE), removes the agent from the cell it entered from as soon as it steps onto this cell.

Source:
Parameters:
Name Type Description
_event GameEvent

Unused.

agent Agent
cell Cell
dir Direction

onColorEventInternal(event, color, cell)

Description:
  • In active mode, removes the agent on this cell when the received color matches AgentDestroyer#color. Skips silently when the cell has no agent.

Source:
Parameters:
Name Type Description
event GameEvent

Unused.

color Color
cell Cell