Photon Quantum 3.0.0

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
Quantum.QuantumEntityViewUpdater Class Reference

The Entity View Updater is essential. An instance needs to be present to create Entity Views as the simulation view representations based on the Quantum.EntityView components. More...

Inheritance diagram for Quantum.QuantumEntityViewUpdater:
Quantum.QuantumMonoBehaviour

Public Member Functions

void AddViewComponent (IQuantumViewComponent viewComponent)
 Attach a non-entity view component that is then updated by the EntityViewUpdater. The QuantumViewComponent<T>.OnActivate will be deferred until the next view update. More...
 
void Awake ()
 Unity Awake() callback, register callbacks and load view contexts. More...
 
QuantumEntityView GetPrefab (EntityRef entityRef)
 Obsolete: Use GetView instead More...
 
QuantumEntityView GetView (EntityRef entityRef)
 Try to get the view instance for the given Quantum entity reference. More...
 
void RemoveViewComponent (IQuantumViewComponent viewComponent)
 Remove a view component from being updated by the EntityViewUpdater. The removing of the view component is being deferred until the next late update. More...
 
void SetCurrentGame (QuantumGame game)
 Set the current observed game. More...
 
void SetTeleportOnce ()
 Obsolete: Use TeleportAllEntities() instead. More...
 
void TeleportAllEntities ()
 Set all entity views to teleport on the next update. More...
 

Public Attributes

bool AutoFindMapData = true
 Disable you don't intend to use MapData component. More...
 
QuantumGame ObservedGame => _observedGame
 Returns the currently observed game. More...
 
QuantumSnapshotInterpolationTimer SnapshotInterpolation = new QuantumSnapshotInterpolationTimer()
 Configuration of the snapshot interpolation mode of EntityViews. More...
 
Transform ViewParentTransform = null
 "Optionally provide a transform that all entity views will be parented under." More...
 

Protected Member Functions

virtual void ActivateMapEntityInstance (QuantumEntityView instance, Vector3? position=null, Quaternion? rotation=null)
 Activates a map entity instance. More...
 
virtual QuantumEntityView CreateEntityViewInstance (Quantum.EntityView asset, Vector3? position=null, Quaternion? rotation=null)
 Creates a new entity view instance. More...
 
virtual void DestroyEntityView (QuantumGame game, QuantumEntityView view)
 Destroys the entity view instance and removes it from the active views list. More...
 
virtual void DestroyEntityViewInstance (QuantumEntityView instance)
 Destroys an entity view. More...
 
virtual void DisableMapEntityInstance (QuantumEntityView instance)
 Disabled a map entity instance. More...
 
virtual void LoadMissingPrefab (Quantum.EntityView viewAsset)
 Is triggered when EntityView.Prefab is null and expects to be set after this callback. More...
 

Protected Attributes

HashSet< EntityRefActiveEntities => _activeEntities
 Provides access to the active entities. More...
 
Dictionary< EntityRef, QuantumEntityViewActiveViews => _activeViews
 Provides access to the active views. More...
 
QuantumMapData MapData => _mapData
 Provides access to MapData when deriving from this class for example. More...
 
HashSet< EntityRefRemoveEntities => _removeEntities
 Privates access to the entities that should be removed. More...
 
Boolean Teleport => _teleport
 Returns true when the entities are marked to teleport next update. Set by TeleportAllEntities. More...
 

Properties

Dictionary< Type, IQuantumViewContextContext [get]
 Access all view contexts that could be loaded in the scene as children of the EntityViewUpdater. More...
 
IQuantumEntityViewPool Pool [get, set]
 Get or set the EntityViewPool. If not set, the EntityViewUpdater will use the first found pool in the hierarchy. More...
 

Detailed Description

The Entity View Updater is essential. An instance needs to be present to create Entity Views as the simulation view representations based on the Quantum.EntityView components.

Member Function Documentation

◆ GetPrefab()

QuantumEntityView Quantum.QuantumEntityViewUpdater.GetPrefab ( EntityRef  entityRef)

Obsolete: Use GetView instead

◆ GetView()

QuantumEntityView Quantum.QuantumEntityViewUpdater.GetView ( EntityRef  entityRef)
inline

Try to get the view instance for the given Quantum entity reference.

Parameters
entityRef
Returns

◆ SetTeleportOnce()

void Quantum.QuantumEntityViewUpdater.SetTeleportOnce ( )

Obsolete: Use TeleportAllEntities() instead.

◆ TeleportAllEntities()

void Quantum.QuantumEntityViewUpdater.TeleportAllEntities ( )
inline

Set all entity views to teleport on the next update.

◆ SetCurrentGame()

void Quantum.QuantumEntityViewUpdater.SetCurrentGame ( QuantumGame  game)
inline

Set the current observed game.

◆ Awake()

void Quantum.QuantumEntityViewUpdater.Awake ( )
inline

Unity Awake() callback, register callbacks and load view contexts.

◆ AddViewComponent()

void Quantum.QuantumEntityViewUpdater.AddViewComponent ( IQuantumViewComponent  viewComponent)
inline

Attach a non-entity view component that is then updated by the EntityViewUpdater. The QuantumViewComponent<T>.OnActivate will be deferred until the next view update.

Does not add the view component if it already was added (e.g. IQuantumViewComponent.IsInitialized returns true).

Parameters
viewComponentView component instance

◆ RemoveViewComponent()

void Quantum.QuantumEntityViewUpdater.RemoveViewComponent ( IQuantumViewComponent  viewComponent)
inline

Remove a view component from being updated by the EntityViewUpdater. The removing of the view component is being deferred until the next late update.

Parameters
viewComponentView component instance to remove

◆ DestroyEntityView()

virtual void Quantum.QuantumEntityViewUpdater.DestroyEntityView ( QuantumGame  game,
QuantumEntityView  view 
)
inlineprotectedvirtual

Destroys the entity view instance and removes it from the active views list.

Can be overwritten in derived class.

Parameters
gameThe game reference the entity belongs to.
viewThe entity view object.

◆ CreateEntityViewInstance()

virtual QuantumEntityView Quantum.QuantumEntityViewUpdater.CreateEntityViewInstance ( Quantum.EntityView  asset,
Vector3?  position = null,
Quaternion?  rotation = null 
)
inlineprotectedvirtual

Creates a new entity view instance.

Can be overwritten in derived class.

Parameters
assetView asset.
positionWorld position.
rotationInitial rotation.
Returns
A new Quantum entity view instance.

◆ DestroyEntityViewInstance()

virtual void Quantum.QuantumEntityViewUpdater.DestroyEntityViewInstance ( QuantumEntityView  instance)
inlineprotectedvirtual

Destroys an entity view.

Can be overwritten in derived class.

Parameters
instanceInstance to destroy.

◆ ActivateMapEntityInstance()

virtual void Quantum.QuantumEntityViewUpdater.ActivateMapEntityInstance ( QuantumEntityView  instance,
Vector3?  position = null,
Quaternion?  rotation = null 
)
inlineprotectedvirtual

Activates a map entity instance.

Can be overwritten in derived class.

◆ DisableMapEntityInstance()

virtual void Quantum.QuantumEntityViewUpdater.DisableMapEntityInstance ( QuantumEntityView  instance)
inlineprotectedvirtual

Disabled a map entity instance.

Can be overwritten in derived class.

◆ LoadMissingPrefab()

virtual void Quantum.QuantumEntityViewUpdater.LoadMissingPrefab ( Quantum.EntityView  viewAsset)
inlineprotectedvirtual

Is triggered when EntityView.Prefab is null and expects to be set after this callback.

Can be overwritten in derived class.

Parameters
viewAssetView asset to load.

Member Data Documentation

◆ ViewParentTransform

Transform Quantum.QuantumEntityViewUpdater.ViewParentTransform = null

"Optionally provide a transform that all entity views will be parented under."

◆ AutoFindMapData

bool Quantum.QuantumEntityViewUpdater.AutoFindMapData = true

Disable you don't intend to use MapData component.

◆ SnapshotInterpolation

QuantumSnapshotInterpolationTimer Quantum.QuantumEntityViewUpdater.SnapshotInterpolation = new QuantumSnapshotInterpolationTimer()

Configuration of the snapshot interpolation mode of EntityViews.

◆ MapData

QuantumMapData Quantum.QuantumEntityViewUpdater.MapData => _mapData
protected

Provides access to MapData when deriving from this class for example.

◆ ActiveEntities

HashSet<EntityRef> Quantum.QuantumEntityViewUpdater.ActiveEntities => _activeEntities
protected

Provides access to the active entities.

◆ RemoveEntities

HashSet<EntityRef> Quantum.QuantumEntityViewUpdater.RemoveEntities => _removeEntities
protected

Privates access to the entities that should be removed.

◆ ActiveViews

Dictionary<EntityRef, QuantumEntityView> Quantum.QuantumEntityViewUpdater.ActiveViews => _activeViews
protected

Provides access to the active views.

◆ Teleport

Boolean Quantum.QuantumEntityViewUpdater.Teleport => _teleport
protected

Returns true when the entities are marked to teleport next update. Set by TeleportAllEntities.

◆ ObservedGame

QuantumGame Quantum.QuantumEntityViewUpdater.ObservedGame => _observedGame

Returns the currently observed game.

Property Documentation

◆ Pool

IQuantumEntityViewPool Quantum.QuantumEntityViewUpdater.Pool
getset

Get or set the EntityViewPool. If not set, the EntityViewUpdater will use the first found pool in the hierarchy.

◆ Context

Dictionary<Type, IQuantumViewContext> Quantum.QuantumEntityViewUpdater.Context
get

Access all view contexts that could be loaded in the scene as children of the EntityViewUpdater.