Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TurnSystem

Contains methods to interact with the turn system: rounds, phases, and turns. Accessed through GameWorld.turns

Hierarchy

  • TurnSystem

Index

Properties

onTurnChanged

onTurnChanged: MulticastDelegate<(previousTurn: number, previousPhase: number, previousRound: number) => void>

Called when a turn (or phase, or round) changes.

param

The active turn before the change

param

The active phase before the change

param

The active round before the change

Methods

getActivePlayers

  • getActivePlayers(): Player[]
  • Return the currently active players. Returns an empty array if no phases exist, and an array with a single element of the player whose turn it is if the current phase is set to take turns.

    Returns Player[]

getAllPhases

getCurrentPhase

  • Return the current phase. Returns a phase with an empty name if no phases are configured.

    Returns PhaseDetails

getCurrentPhaseIndex

  • getCurrentPhaseIndex(): number
  • Return the current phase. Returns -1 if no phases are configured.

    Returns number

getCurrentRound

  • getCurrentRound(): number

getCurrentTurn

  • getCurrentTurn(): number
  • Return the current turn. Returns -1 if currently not in a phase that has turns.

    Returns number

nextTurn

  • nextTurn(): void
  • Moves to the next turn. Will also change phase and round as required and cause a message to appear for all players. Does the same as a player clicking on the next turn button in the context menu. Triggers a message for players and the onTurnChanged event.

    Returns void

previousTurn

  • previousTurn(): void
  • Moves to the previous turn. Will also change phase and round as required and cause a message to appear for all players. Does the same as a player clicking on the previous turn button in the context menu. Triggers a message for players and the onTurnChanged event.

    Returns void

setCurrentPhaseIndex

  • setCurrentPhaseIndex(phase: number): void
  • Set the current phase index

    Parameters

    • phase: number

    Returns void

setCurrentRound

  • setCurrentRound(round: number): void
  • Sets the current round. Does not trigger a message for players or the onTurnChanged event.

    Parameters

    • round: number

    Returns void

setCurrentTurn

  • setCurrentTurn(turn: number): void
  • Set the current turn. Does not trigger a message for players or the onTurnChanged event.

    Parameters

    • turn: number

    Returns void

setPhases