Options
All
  • Public
  • Public/Protected
  • All
Menu

A Zone object to be used to find where a given player is

Hierarchy

  • Zone

Index

Constructors

  • new Zone(definition?: string): Zone
  • Create a new zone from a JSON stringified definition.

    NB: the y coordinates of the elements in the JSON are in display coordinates so they are inverted in this constructor to be correctly adapted to our coordinate system.

    Parameters

    • Optional definition: string

      the stringified definition of the array of objects composing the zone

    Returns Zone

Methods

  • isInside(x: number, y: number): boolean
  • Check if the given coordinates are inside this zone

    Parameters

    • x: number
    • y: number

    Returns boolean

  • reverse(): void
  • Invert the current zone, this is the same of Zone.specular, but the change will be performed on the actual zone.

    Returns void

  • Create a specular zone, may be useful in tracking rules, the result is cached.

    Returns Zone

    a zone that is the specular of the givne one

  • ellipse(x: number, y: number, radiusX: number, radiusY: number): Zone
  • Create a new ellipse zone in percentage of the field size, the origin (0, 0) is the top left corner kick.

    Parameters

    • x: number

      x coordinate of the center

    • y: number

      y coordinate of the center

    • radiusX: number

      radius on the X axis (field length) in percent

    • radiusY: number

    Returns Zone

    a new zone created with the ellipse

  • Creates a new poly object from a list of points already ordered in the correct order to be joined.

    Parameters

    • points: Point[]

      list of points already ordered

    Returns Zone

    a new zone created with a poly object

  • rectangle(x: number, y: number, width: number, height: number): Zone
  • Create a new rectangular zone in percentage of the field size, the origin (0, 0) is the top left corner kick.

    Parameters

    • x: number

      x coordinate of the left top corner

    • y: number

      y coordinate of the left top corner

    • width: number

      width in percent of the field length

    • height: number

      height in percent of the field width

    Returns Zone

    a new zone created with the rectangle