Constructor
new Actor(name, actorNr, isLocal)
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Actor name. |
actorNr |
number | Actor ID. |
isLocal |
boolean | Actor is local. |
Methods
getCustomProperties() → {object}
Returns custom properties.
Returns:
Custom properties.
- Type
- object
getCustomProperty(name) → {object}
Returns custom property by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the property. |
Returns:
Property or undefined if property not found.
- Type
- object
getCustomPropertyOrElse(name, defaultValue) → {object}
Returns custom property by name or default value.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the property. |
defaultValue |
object | Default property value. |
Returns:
Property or default value if property not found.
- Type
- object
getRoom() → {Photon.LoadBalancing.Room}
Actor's room: the room initialized by client for create room operation or room client connected to.
Returns:
Actor's room.
isSuspended() → {boolean}
Returns true if actor is in suspended state.
Returns:
Actor suspend state.
- Type
- boolean
onPropertiesChange(changedCustomProps, byClientopt)
Called on every actor properties update: properties set by client, poperties update from server. Override to update custom room state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
changedCustomProps |
object | Key-value map of changed properties. | |
byClient |
boolean |
<optional> |
true if properties set by client. |
raiseEvent(eventCode, dataopt, optionsopt)
Raises game custom event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventCode |
number | Identifies this type of event (and the content). Your game's event codes can start with 0. | |
data |
object |
<optional> |
Custom data you want to send along (use null, if none). |
options |
object |
<optional> |
Additional options |
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Additional options
Properties
|
setCustomProperties(properties, webForwardopt, expectedPropertiesopt)
Sets custom properties.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
properties |
object | Table of properties to set. | ||
webForward |
boolean |
<optional> |
false | Forward to web hook. |
expectedProperties |
object |
<optional> |
Table of properties expected when update occurs. Use null as value if you expect the property to not exist. (CAS : "Check And Swap") |
setCustomProperty(name, value, webForwardopt, expectedValueopt)
Sets custom property.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | Name of the property. | ||
value |
object | Property value. | ||
webForward |
boolean |
<optional> |
false | Forward to web hook. |
expectedValue |
object |
<optional> |
Property value expected when update occurs. (CAS : "Check And Swap") |
setName(name)
Sets actor name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Actor name. |