Photon Quantum 3.0.0

Public Member Functions | Public Attributes | Protected Attributes | Properties | List of all members
Quantum.QuantumViewComponent< T > Class Template Reference

The base class to inherit entity view components from. Entity view components can be used to add features to entity views and gain simple access to all relevant Quantum game API and the Quantum entity. More...

Inheritance diagram for Quantum.QuantumViewComponent< T >:
Quantum.QuantumMonoBehaviour Quantum.IQuantumViewComponent Quantum.QuantumEntityViewComponent< T > Quantum.QuantumSceneViewComponent< T >

Public Member Functions

void Activate (Frame frame, QuantumGame game, QuantumEntityView entityView)
 Is only called internally. Sets the entity view parent. More...
 
void Deactivate ()
 Is only called internally. More...
 
void GameChanged (QuantumGame game)
 Is only called internally. More...
 
void Initialize (Dictionary< Type, IQuantumViewContext > contexts)
 Is only called internally. Sets the view context of this entity view component. More...
 
void LateUpdateView ()
 Is only called internally. More...
 
virtual void OnActivate (Frame frame)
 Is called when the entity view is activated and the entity was created. More...
 
virtual void OnDeactivate ()
 Is called when the view component is deactivated. More...
 
virtual void OnGameChanged ()
 Is called from the QuantumEntityViewUpdater then the observed game is changed. More...
 
virtual void OnInitialize ()
 Is called when the entity view is enabled for the first time. The ViewContext is already set if available. Access to Game, VerifiedFrame, PredictedFrame and PredictedPreviousFrame is not available yet. More...
 
virtual void OnLateUpdateView ()
 Is called from the QuantumEntityViewUpdater on a Unity late update. More...
 
virtual void OnUpdateView ()
 Is called from the QuantumEntityViewUpdater on a Unity update. More...
 
void UpdateView ()
 Is only called internally. More...
 

Public Attributes

virtual QuantumGame Game => _game
 The Game that the entity belongs to. This can change after the OnGameChanged() callback. Set before calling OnActivate(Frame). More...
 
Frame PredictedFrame => Game?.Frames.Predicted
 The newest predicted frame. Set before calling OnActivate(Frame). More...
 
Frame PredictedPreviousFrame => Game?.Frames.PredictedPrevious
 The newest predicted previous frame. Set before calling OnActivate(Frame). More...
 
Frame VerifiedFrame => Game?.Frames.Verified
 The newest verified frame. Set before calling OnActivate(Frame). More...
 

Protected Attributes

QuantumEntityView _entityView
 Cached entity view is updated during Activate. More...
 
QuantumGame _game
 Cached game object is updated during Activate and GameChanged. More...
 

Properties

bool IsActive [get]
 Is the view component currently activated. More...
 
bool IsInitialized [get]
 Returns true if the view component has been initialized. More...
 
ViewContext [get]
 The view context of the QuantumEntityViewUpdater associated with this entity view component. More...
 
- Properties inherited from Quantum.IQuantumViewComponent
bool IsActive [get]
 Is toggled during Activate and Deactivate."/> More...
 

Detailed Description

The base class to inherit entity view components from. Entity view components can be used to add features to entity views and gain simple access to all relevant Quantum game API and the Quantum entity.

Template Parameters
TThe type of the custom view context used by this view component. Can be IQuantumEntityViewContext if not required.
Type Constraints
T :IQuantumViewContext 

Member Function Documentation

◆ OnInitialize()

virtual void Quantum.QuantumViewComponent< T >.OnInitialize ( )
inlinevirtual

Is called when the entity view is enabled for the first time. The ViewContext is already set if available. Access to Game, VerifiedFrame, PredictedFrame and PredictedPreviousFrame is not available yet.

◆ OnActivate()

virtual void Quantum.QuantumViewComponent< T >.OnActivate ( Frame  frame)
inlinevirtual

Is called when the entity view is activated and the entity was created.

Parameters
frameThe frame that the entity was created with, can be predicted or verified base on the QuantumEntityViewBindBehaviour

.

◆ OnDeactivate()

virtual void Quantum.QuantumViewComponent< T >.OnDeactivate ( )
inlinevirtual

Is called when the view component is deactivated.

◆ OnUpdateView()

virtual void Quantum.QuantumViewComponent< T >.OnUpdateView ( )
inlinevirtual

Is called from the QuantumEntityViewUpdater on a Unity update.

◆ OnLateUpdateView()

virtual void Quantum.QuantumViewComponent< T >.OnLateUpdateView ( )
inlinevirtual

Is called from the QuantumEntityViewUpdater on a Unity late update.

◆ OnGameChanged()

virtual void Quantum.QuantumViewComponent< T >.OnGameChanged ( )
inlinevirtual

Is called from the QuantumEntityViewUpdater then the observed game is changed.

◆ Initialize()

void Quantum.QuantumViewComponent< T >.Initialize ( Dictionary< Type, IQuantumViewContext contexts)
inline

Is only called internally. Sets the view context of this entity view component.

Parameters
contextsAll of the different contexts of the EntityViewUpdater, will select the matching type.

Implements Quantum.IQuantumViewComponent.

◆ Activate()

void Quantum.QuantumViewComponent< T >.Activate ( Frame  frame,
QuantumGame  game,
QuantumEntityView  entityView 
)
inline

Is only called internally. Sets the entity view parent.

Parameters
frame
game
entityView

Implements Quantum.IQuantumViewComponent.

◆ Deactivate()

void Quantum.QuantumViewComponent< T >.Deactivate ( )
inline

Is only called internally.

Implements Quantum.IQuantumViewComponent.

◆ UpdateView()

void Quantum.QuantumViewComponent< T >.UpdateView ( )
inline

Is only called internally.

Implements Quantum.IQuantumViewComponent.

◆ LateUpdateView()

void Quantum.QuantumViewComponent< T >.LateUpdateView ( )
inline

Is only called internally.

Implements Quantum.IQuantumViewComponent.

◆ GameChanged()

void Quantum.QuantumViewComponent< T >.GameChanged ( QuantumGame  game)
inline

Is only called internally.

Implements Quantum.IQuantumViewComponent.

Member Data Documentation

◆ Game

The Game that the entity belongs to. This can change after the OnGameChanged() callback. Set before calling OnActivate(Frame).

◆ PredictedFrame

Frame Quantum.QuantumViewComponent< T >.PredictedFrame => Game?.Frames.Predicted

The newest predicted frame. Set before calling OnActivate(Frame).

◆ VerifiedFrame

Frame Quantum.QuantumViewComponent< T >.VerifiedFrame => Game?.Frames.Verified

The newest verified frame. Set before calling OnActivate(Frame).

◆ PredictedPreviousFrame

Frame Quantum.QuantumViewComponent< T >.PredictedPreviousFrame => Game?.Frames.PredictedPrevious

The newest predicted previous frame. Set before calling OnActivate(Frame).

◆ _game

Cached game object is updated during Activate and GameChanged.

◆ _entityView

QuantumEntityView Quantum.QuantumViewComponent< T >._entityView
protected

Cached entity view is updated during Activate.

Property Documentation

◆ ViewContext

T Quantum.QuantumViewComponent< T >.ViewContext
get

The view context of the QuantumEntityViewUpdater associated with this entity view component.

◆ IsActive

bool Quantum.QuantumViewComponent< T >.IsActive
get

Is the view component currently activated.

◆ IsInitialized

bool Quantum.QuantumViewComponent< T >.IsInitialized
get

Returns true if the view component has been initialized.