AgentGate

AgentGate

Restricts cell traversal to the player only — all non-player agents are prevented from both entering and exiting.

Typical use: confine enemies to a region or corridor without affecting player movement — e.g. line the border of an arena so its inhabitants cannot wander out.

Constructor

new AgentGate(terrain)

Source:
Parameters:
Name Type Description
terrain Terrain

The underlying terrain this decorator wraps.

Extends

Classes

AgentGate

Members

terrain :Terrain

Source:
Overrides:
Type:

Methods

canEnter(agent, cell, direction) → {boolean}

Description:
  • Allows entry only for the player; delegates to the wrapped terrain for the player, and returns false for all other agents.

Source:
Parameters:
Name Type Description
agent Agent
cell Cell
direction Direction
Returns:
Type
boolean

canExit(agent, cell, direction) → {boolean}

Description:
  • Allows exit only for the player; delegates to the wrapped terrain for the player, and returns false for all other agents.

Source:
Parameters:
Name Type Description
agent Agent
cell Cell
direction Direction
Returns:
Type
boolean

getProxiedTerrain()

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

Source:
Overrides: