new Actor(name, actorNr, isLocal)
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Actor name. |
actorNr |
number | Actor ID. |
isLocal |
boolean | Actor is local. |
- Source:
- Photon-Javascript_SDK.js, line 906
Methods
-
getCustomProperties() → {object}
Returns custom properties.
-
- Source:
- Photon-Javascript_SDK.js, line 1053
Returns:
Custom properties.- Type
- object
-
getCustomProperty(name) → {object}
Returns custom property by name.
-
Parameters:
Name Type Description namestring Name of the property. - Source:
- Photon-Javascript_SDK.js, line 979
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 namestring Name of the property. defaultValueobject Default property value. - Source:
- Photon-Javascript_SDK.js, line 986
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.
-
- Source:
- Photon-Javascript_SDK.js, line 922
Returns:
Actor's room. -
isSuspended() → {boolean}
Returns true if actor is in suspended state.
-
- Source:
- Photon-Javascript_SDK.js, line 1036
Returns:
Actor suspend state.- Type
- boolean
-
onPropertiesChange(changedCustomProps, byClient)
Called on every actor properties update: properties set by client, poperties update from server. Override to update custom room state.
-
Parameters:
Name Type Argument Description changedCustomPropsobject Key-value map of changed properties. byClientboolean <optional>
true if properties set by client. - Source:
- Photon-Javascript_SDK.js, line 971
-
raiseEvent(eventCode, data, options)
Raises game custom event.
-
Parameters:
Name Type Argument Description eventCodenumber Identifies this type of event (and the content). Your game's event codes can start with 0. dataobject <optional>
Custom data you want to send along (use null, if none). optionsobject <optional>
Additional options - Source:
- Photon-Javascript_SDK.js, line 928
Properties:
Name Type Description optionsobject Additional options Properties
Name Type Argument Default Description interestGroupnumber <optional>
The ID of the interest group this event goes to (exclusively). cachePhoton.LoadBalancing.Constants.EventCaching <optional>
EventCaching.DoNotCache Events can be cached (merged and removed) for players joining later on. receiversPhoton.LoadBalancing.Constants.ReceiverGroup <optional>
ReceiverGroup.Others Defines to which group of players the event is passed on. targetActorsnumber[] <optional>
Defines the target players who should receive the event (use only for small target groups). webForwardboolean <optional>
false Forward to web hook. -
setCustomProperties(properties, webForward, expectedProperties)
Sets custom properties.
-
Parameters:
Name Type Argument Default Description propertiesobject Table of properties to set. webForwardboolean <optional>
false Forward to web hook. expectedPropertiesobject <optional>
Table of properties expected when update occurs. (CAS : "Check And Swap") - Source:
- Photon-Javascript_SDK.js, line 1017
-
setCustomProperty(name, value, webForward, expectedValue)
Sets custom property.
-
Parameters:
Name Type Argument Default Description namestring Name of the property. valueobject Property value. webForwardboolean <optional>
false Forward to web hook. expectedValueobject <optional>
Property value expected when update occurs. (CAS : "Check And Swap") - Source:
- Photon-Javascript_SDK.js, line 994
-
setName(name)
Sets actor name.
-
Parameters:
Name Type Description namestring Actor name. - Source:
- Photon-Javascript_SDK.js, line 959