Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LobbyBehaviour<RoomType>

Represents a room object for the Lobby map.

See LobbyBehaviourEvents for events to listen to.

Type parameters

  • RoomType: Hostable

Hierarchy

Index

Properties

Static spawnPositions

spawnPositions: Vector2[] = ...

components

components: Networkable<any, NetworkableEvents<Hostable<any>>, RoomType>[]

dirtyBit

dirtyBit: number = 0

The dirty state of this component.

flags

flags: number

Flags for this object, see SpawnFlag.

netId

netId: number

The net ID of this component.

ownerId

ownerId: number

The ID of the owner of this component.

Optional player

player: PlayerData<RoomType>

The player that this component belongs to.

room

room: RoomType

The room that this component belongs to.

spawnType

spawnType: SpawnType

The type of object that this component belongs to.

Methods

Awake

  • Awake(): void

Deserialize

  • Deserialize(reader: HazelReader, spawn?: boolean): void

Destroy

  • Destroy(): void

FixedUpdate

  • FixedUpdate(delta: number): void

HandleRpc

PreSerialize

  • PreSerialize(): void

Serialize

  • Serialize(writer: HazelWriter, spawn?: boolean): boolean

canBeManaged

  • canBeManaged(): boolean

despawn

  • despawn(): void
  • Despawns the component from the room it belongs in.

    Returns void

emit

  • emit<Event>(event: Event): Promise<Event>

emitSerial

  • emitSerial<Event>(event: Event): Promise<Event>

emitSync

  • emitSync<Event>(event: Event): Event

getComponent

  • getComponent<T>(component: NetworkableConstructor<T>): undefined | T
  • Type parameters

    • T: Networkable<any, NetworkableEvents<Hostable<any>>, Hostable<any>, T>

    Parameters

    • component: NetworkableConstructor<T>

    Returns undefined | T

getListeners

  • getListeners<Event>(event: string): Listener<Event>[]

off

  • off<EventName>(event: EventName, listener: Listener<LobbyBehaviourEvents<RoomType>[EventName]>): void
  • off<K>(event: string, listener: Listener<K>): void

on

  • on<EventName>(event: EventName, listener: Listener<LobbyBehaviourEvents<RoomType>[EventName]>): () => void
  • on<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

once

  • once<EventName>(event: EventName, listener: Listener<LobbyBehaviourEvents<RoomType>[EventName]>): () => void
  • once<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn"

    Parameters

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

removeAllListeners

  • removeAllListeners(): void

removeListeners

  • removeListeners(event: string): void

spawn

  • spawn(): void
  • Spawn this component if does not exist in the room it belongs in.

    Returns void

wait

waitf

  • waitf<EventName>(event: EventName, filter: (ev: LobbyBehaviourEvents<RoomType>[EventName]) => boolean | Promise<boolean>): Promise<LobbyBehaviourEvents<RoomType>[EventName]>
  • waitf<K>(event: string, filter: (ev: K) => boolean | Promise<boolean>): Promise<BasicEvent>

Constructors

constructor

Accessors

owner

  • get owner(): RoomType

Generated using TypeDoc