A Game Entity within the Bolt simulation. More...
Public Member Functions | |
void | AddEventCallback< T > (Action< T > callback) |
Add a event callback to this entity. More... | |
void | AddEventListener (UE.MonoBehaviour behaviour) |
Add an event listener to this entity. More... | |
void | AssignControl (BoltConnection connection) |
Assigns control of this entity to a connection More... | |
void | AssignControl (BoltConnection connection, IProtocolToken token) |
Assigns control of this entity to a connection More... | |
void | ClearInputQueue () |
void | DestroyDelayed (float time) |
Destroy this entity after a given delay More... | |
void | Freeze (bool pause) |
Freeze or unfreeze an entity More... | |
TState | GetState< TState > () |
Get the state if this entity More... | |
void | Idle (BoltConnection connection, bool idle) |
Set this entity as idle on the supplied connection, this means that the connection will not receive update state for this entity as long as it's idle. More... | |
bool | IsController (BoltConnection connection) |
Checks if this entity is being controlled by the connection More... | |
BoltEntitySettingsModifier | ModifySettings () |
Creates an object which lets you modify the internal settings of an entity before it is attached to Bolt. More... | |
bool | QueueInput (INetworkCommandData data, bool force=false) |
Queue an input data on this entity for execution. This is called on a client which is controlling a proxied entity. The data will be sent to the server for authoritative execution More... | |
void | ReleaseControl () |
Releases local control of this entity More... | |
void | ReleaseControl (IProtocolToken token) |
Releases local control of this entity More... | |
void | RemoveEventCallback< T > (Action< T > callback) |
Remove a event callback to this entity. More... | |
void | RemoveEventListener (UE.MonoBehaviour behaviour) |
Remove an event listern from this entity More... | |
void | RevokeControl () |
Revokes control of this entity from a connection More... | |
void | RevokeControl (IProtocolToken token) |
Revokes control of this entity from a connection More... | |
void | SetParent (BoltEntity parent) |
Sets the parent of this entity More... | |
void | SetScope (BoltConnection connection, bool inScope, bool force=false) |
Sets the scope for the connection passed in for this entity. Only usable if Scope Mode has been set to Manual. More... | |
void | SetScopeAll (bool inScope, bool force=false) |
Sets the scope of all currently active connections for this entity. Only usable if Scope Mode has been set to Manual. More... | |
bool | StateIs (Type t) |
Checks which type of state this entity has More... | |
bool | StateIs< TState > () |
Checks which type of state this entity has More... | |
void | TakeControl () |
Takes local control of this entity More... | |
void | TakeControl (IProtocolToken token) |
Takes local control of this entity More... | |
override string | ToString () |
String representation of the entity More... | |
bool | TryFindState< TState > (out TState state) |
A null safe way to look for a specific type of state on an entity More... | |
Static Public Member Functions | |
static implicit | operator UE.GameObject (BoltEntity entity) |
Public Attributes | |
IProtocolToken | AttachToken => Entity.AttachToken |
IProtocolToken | ControlGainedToken => Entity.ControlGainedToken |
BoltConnection | Controller => Entity.Controller |
If this entity is controlled by a remote connection it contains that connection, otherwise null More... | |
IProtocolToken | ControlLostToken => Entity.ControlLostToken |
IProtocolToken | DetachToken => Entity.DetachToken |
bool | HasControl => Entity.HasControl |
Do we have control of this entity? More... | |
bool | HasControlWithPrediction => Entity.HasPredictedControl |
Do we have control of this entity and are we using client side prediction More... | |
bool | HasParent => Entity.HasParent |
Gets a value indicating whether this T:BoltEntity has parent. More... | |
bool | IsAttached => BoltNetwork.IsRunning && (_entity != null) && _entity.IsAttached |
If this entity is attached to Bolt or not More... | |
bool | IsControlled => HasControl || Controller != null |
bool | IsControllerOrOwner => HasControl || IsOwner |
bool | IsFrozen => Entity.IsFrozen |
If this entity is currently paused More... | |
bool | IsInputQueueFull => Entity.CommandQueue.count == BoltCore._config.commandQueueSize |
Gets a value indicating whether this T:BoltEntity has its input queue full. More... | |
bool | IsOwner => Entity.IsOwner |
Did the local computer create this entity or not? More... | |
bool | IsSceneObject => Entity.IsSceneObject |
This is a scene object placed in the scene in the Unity editor More... | |
NetworkId | NetworkId => Entity.NetworkId |
The unique id of this entity More... | |
bool | PersistsOnSceneLoad => Entity.PersistsOnSceneLoad |
Should this entity persist between scene loads More... | |
PrefabId | PrefabId => new PrefabId(_prefabId) |
The prefabId used to instantiate this entity More... | |
BoltConnection | Source => Entity.Source |
If this entity was created on another computer, contains the connection we received this entity from, otherwise null More... | |
Properties | |
bool | CanFreeze [get, set] |
Whether the entity can be paused / frozen More... | |
A Game Entity within the Bolt simulation.
Example: Instantiating and taking control of a new BoltEntity
that will replicate to all connected clients.
|
inline |
Add a event callback to this entity.
T | : | Event |
|
inline |
Add an event listener to this entity.
behaviour | The behaviour to invoke event callbacks on |
|
inline |
Assigns control of this entity to a connection
connection | The connection to assign control to |
Example: Instantiating and assigning control of an entity to a newly connected player.
|
inline |
Assigns control of this entity to a connection
connection | The connection to assign control to |
token | A data token of max size 512 bytes |
Example: Instantiating and assigning control of an entity to a newly connected player.
|
inline |
|
inline |
Destroy this entity after a given delay
time | The time interval to delay |
Example: A death routine that makes state changes and initiates a destruction with configurable delay.
|
inline |
Freeze or unfreeze an entity
pause | True if entity should freeze and false to unfreeze |
Example: Pausing all entities.
|
inline |
Get the state if this entity
TState | The type of state to get |
Example: Modifying the state of an entity to change its name.
|
inline |
Set this entity as idle on the supplied connection, this means that the connection will not receive update state for this entity as long as it's idle.
connection | The connection to idle the entity on |
idle | If this should be idle or not |
|
inline |
Checks if this entity is being controlled by the connection
connection | The connection to check |
|
inline |
Creates an object which lets you modify the internal settings of an entity before it is attached to Bolt.
|
inlinestatic |
|
inline |
Queue an input data on this entity for execution. This is called on a client which is controlling a proxied entity. The data will be sent to the server for authoritative execution
data | The input data to queue |
force | Used to force the inclusion of this input, by discarding any other values if the Input Queue is full |
Example: A SimulateController()
loop that queues WASD-style movement input.
|
inline |
Releases local control of this entity
Example: Releasing control of an entity when it's not needed anymore.
|
inline |
Releases local control of this entity
token | A data token of max size 512 bytes |
Example: Releasing control of an entity when it's not needed anymore.
|
inline |
Remove a event callback to this entity.
T | : | Event |
|
inline |
Remove an event listern from this entity
behaviour | The behaviour to remove |
|
inline |
Revokes control of this entity from a connection
Example: A server-side stun routine that completely revokes control for the length of stun interval.
|
inline |
Revokes control of this entity from a connection
token | A data token of max size 512 bytes |
Example: A server-side stun routine that completely revokes control for the length of stun interval.
|
inline |
Sets the parent of this entity
parent | The parent of this entity |
Example: Instantiating a vehicle and taking control of it.
|
inline |
Sets the scope for the connection passed in for this entity. Only usable if Scope Mode has been set to Manual.
connection | The connection being scoped |
inScope | If this entity should be in scope or not |
force | Force the scope value, used in the case you want to remove from the scope an entity the connection has control |
Example: A coroutine that renders a player invisible to enemies for a given time in seconds.
|
inline |
Sets the scope of all currently active connections for this entity. Only usable if Scope Mode has been set to Manual.
inScope | If this entity should be in scope or not |
force | Force the scope value, used in the case you want to remove from the scope an entity the connection has control |
Example: A method which renders an entity invisible to all active client connections.
|
inline |
Checks which type of state this entity has
t | The type of state to check for |
Example: Discarding attack requests that do not target living entities.
|
inline |
Checks which type of state this entity has
TState | The type of state to check for |
Example: Discarding attack requests that do not target living entities.
|
inline |
Takes local control of this entity
Example: Spawning a server-side player entity.
|
inline |
Takes local control of this entity
token | A data token of max size 512 bytes |
Example: Spawning a server-side player entity and initializing it with a local hotkey configuration.
|
inline |
String representation of the entity
Example: Logging new entities to the debug log.
|
inline |
A null safe way to look for a specific type of state on an entity
TState | The state type to search for |
state | Entity to search |
Example: Pausing all player entities using TryFindState()
.
IProtocolToken Photon.Bolt.BoltEntity.AttachToken => Entity.AttachToken |
IProtocolToken Photon.Bolt.BoltEntity.ControlGainedToken => Entity.ControlGainedToken |
BoltConnection Photon.Bolt.BoltEntity.Controller => Entity.Controller |
If this entity is controlled by a remote connection it contains that connection, otherwise null
Example: Disconnecting a client when they run out of lives.
IProtocolToken Photon.Bolt.BoltEntity.ControlLostToken => Entity.ControlLostToken |
IProtocolToken Photon.Bolt.BoltEntity.DetachToken => Entity.DetachToken |
bool Photon.Bolt.BoltEntity.HasControl => Entity.HasControl |
Do we have control of this entity?
Example: Implementing a method to turn controlled entities green on the minimap.
bool Photon.Bolt.BoltEntity.HasControlWithPrediction => Entity.HasPredictedControl |
Do we have control of this entity and are we using client side prediction
bool Photon.Bolt.BoltEntity.HasParent => Entity.HasParent |
Gets a value indicating whether this T:BoltEntity has parent.
true
if has parent; otherwise, false
.
bool Photon.Bolt.BoltEntity.IsAttached => BoltNetwork.IsRunning && (_entity != null) && _entity.IsAttached |
If this entity is attached to Bolt or not
Example: Checking if an entity is still attached before trying to modify the state. This can occur if entities are destroyed immediately upon death.
void DealDamage(BoltEntity entity, AttackData atkData) { if(entity.IsAttached) { entity.GetState<ILivingEntity>().hp -= atkData.damage; } }
bool Photon.Bolt.BoltEntity.IsControlled => HasControl || Controller != null |
bool Photon.Bolt.BoltEntity.IsControllerOrOwner => HasControl || IsOwner |
bool Photon.Bolt.BoltEntity.IsFrozen => Entity.IsFrozen |
If this entity is currently paused
Example: Unpausing all frozen entities.
bool Photon.Bolt.BoltEntity.IsInputQueueFull => Entity.CommandQueue.count == BoltCore._config.commandQueueSize |
Gets a value indicating whether this T:BoltEntity has its input queue full.
true
if is input queue full; otherwise, false
.
bool Photon.Bolt.BoltEntity.IsOwner => Entity.IsOwner |
Did the local computer create this entity or not?
Example: Implementing an authoritative weapon firing method.
bool Photon.Bolt.BoltEntity.IsSceneObject => Entity.IsSceneObject |
This is a scene object placed in the scene in the Unity editor
Example: Configuring the state of initial buildings and minions during startup.
NetworkId Photon.Bolt.BoltEntity.NetworkId => Entity.NetworkId |
The unique id of this entity
bool Photon.Bolt.BoltEntity.PersistsOnSceneLoad => Entity.PersistsOnSceneLoad |
Should this entity persist between scene loads
Example: Pausing all persistent entities before changing scenes
PrefabId Photon.Bolt.BoltEntity.PrefabId => new PrefabId(_prefabId) |
The prefabId used to instantiate this entity
Example: Cloning an entity with prefabId
.
BoltConnection Photon.Bolt.BoltEntity.Source => Entity.Source |
If this entity was created on another computer, contains the connection we received this entity from, otherwise null
Example: Using source
to determine if an entity was originally instantiated on a remote host.
|
getset |
Whether the entity can be paused / frozen
Example: Pausing all entities that can be frozen.