Photon Quantum 3.0.0

Public Member Functions | Public Attributes | List of all members
Quantum.QuantumEntityViewComponent< 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.QuantumEntityViewComponent< T >:
Quantum.QuantumViewComponent< T > Quantum.QuantumMonoBehaviour Quantum.IQuantumViewComponent

Public Member Functions

TComponent GetPredictedQuantumComponent< TComponent > ()
 Returns the desired Quantum component from the entity of the the predicted frame. This method throws exceptions when the Frame or Entity ref are not assigned, as well as when the Quantum entity does not have the component. Core.FrameBase.Get<T>(EntityRef) More...
 
TComponent GetVerifiedQuantumComponent< TComponent > ()
 Returns the desired Quantum component from the entity of the the verified frame. This method throws exceptions when the Frame or Entity ref are not assigned, as well as when the Quantum entity does not have the component. Core.FrameBase.Get<T>(EntityRef) More...
 
bool HasPredictedQuantumComponent< TComponent > ()
 Checks the predicted frame if this Quantum entity has a particular Quantum entity. More...
 
bool HasVerifiedQuantumComponent< TComponent > ()
 Checks the verified frame if this Quantum entity has a particular Quantum entity. More...
 
bool TryGetPredictedQuantumComponent< TComponent > (out TComponent value)
 Try to get the component from this Quantum entity and the predicted frame. Core.FrameBase.TryGet<T>(EntityRef, out T) More...
 
bool TryGetVerifiedQuantumComponent< TComponent > (out TComponent value)
 Try to get the component from this Quantum entity and the verified frame. Core.FrameBase.TryGet<T>(EntityRef, out T) More...
 
- Public Member Functions inherited from Quantum.QuantumViewComponent< T >
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

EntityRef EntityRef => _entityView.EntityRef
 The Quantum EntityRef that the underlying entity view is attached to. More...
 
QuantumEntityView EntityView => _entityView
 A reference to the parent class to access interesting game and entity data. More...
 
override QuantumGame Game => _entityView?.Game
 The Game that the entity belongs to. This can change after the OnGameChanged() callback. Set before calling OnActivate(Frame). More...
 
- Public Attributes inherited from Quantum.QuantumViewComponent< T >
virtual QuantumGame Game => _game
 The Game that the entity belongs to. This can change after the OnGameChanged() callback. Set before calling OnActivate(Frame). More...
 
bool IsActiveAndEnabled => IsActive && enabled && gameObject != null && gameObject.activeInHierarchy
 Returns true if the view component is IsActive and Behaviour.enabled. 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...
 

Additional Inherited Members

- Protected Attributes inherited from Quantum.QuantumViewComponent< T >
QuantumEntityView _entityView
 Cached entity view is updated during Activate. More...
 
QuantumGame _game
 Cached game object is updated during Activate and GameChanged. More...
 
- Properties inherited from Quantum.QuantumViewComponent< T >
bool IsActive [get]
 Is the view component currently activated and not inside the pool. 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...
 
bool IsActiveAndEnabled [get]
 Returns IsActive More...
 
bool IsInitialized [get]
 The initialized state has to kept track of by the view component to not call it multiple times. 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.

A entity view component without context type.

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

◆ HasPredictedQuantumComponent< TComponent >()

bool Quantum.QuantumEntityViewComponent< T >.HasPredictedQuantumComponent< TComponent > ( )

Checks the predicted frame if this Quantum entity has a particular Quantum entity.

Template Parameters
TComponentQuantum component type
Returns
True, if the entity has the component
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 
TComponent :PredictedFrame 
TComponent :null 
TComponent :EntityView 
TComponent :null 
TComponent :false 
TComponent :PredictedFrame.Has<TComponent> 
TComponent :EntityRef 

◆ HasVerifiedQuantumComponent< TComponent >()

bool Quantum.QuantumEntityViewComponent< T >.HasVerifiedQuantumComponent< TComponent > ( )

Checks the verified frame if this Quantum entity has a particular Quantum entity.

Template Parameters
TComponentQuantum component type
Returns
True, if the entity has the component
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 
TComponent :VerifiedFrame 
TComponent :null 
TComponent :EntityView 
TComponent :null 
TComponent :false 
TComponent :VerifiedFrame.Has<TComponent> 
TComponent :EntityRef 

◆ GetPredictedQuantumComponent< TComponent >()

TComponent Quantum.QuantumEntityViewComponent< T >.GetPredictedQuantumComponent< TComponent > ( )

Returns the desired Quantum component from the entity of the the predicted frame. This method throws exceptions when the Frame or Entity ref are not assigned, as well as when the Quantum entity does not have the component. Core.FrameBase.Get<T>(EntityRef)

Template Parameters
TComponentQuantum component type
Returns
The Quantum component
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 
TComponent :PredictedFrame.Get<TComponent> 
TComponent :EntityRef 

◆ GetVerifiedQuantumComponent< TComponent >()

TComponent Quantum.QuantumEntityViewComponent< T >.GetVerifiedQuantumComponent< TComponent > ( )

Returns the desired Quantum component from the entity of the the verified frame. This method throws exceptions when the Frame or Entity ref are not assigned, as well as when the Quantum entity does not have the component. Core.FrameBase.Get<T>(EntityRef)

Template Parameters
TComponentQuantum component type
Returns
The Quantum component
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 
TComponent :VerifiedFrame.Get<TComponent> 
TComponent :EntityRef 

◆ TryGetPredictedQuantumComponent< TComponent >()

bool Quantum.QuantumEntityViewComponent< T >.TryGetPredictedQuantumComponent< TComponent > ( out TComponent  value)
inline

Try to get the component from this Quantum entity and the predicted frame. Core.FrameBase.TryGet<T>(EntityRef, out T)

Template Parameters
TComponentDesired component type
Parameters
valueThe resulting Quantum component instance.
Returns
True when the component was found.
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 

◆ TryGetVerifiedQuantumComponent< TComponent >()

bool Quantum.QuantumEntityViewComponent< T >.TryGetVerifiedQuantumComponent< TComponent > ( out TComponent  value)
inline

Try to get the component from this Quantum entity and the verified frame. Core.FrameBase.TryGet<T>(EntityRef, out T)

Template Parameters
TComponentDesired component type
Parameters
valueThe resulting Quantum component instance.
Returns
True when the component was found.
Type Constraints
TComponent :unmanaged 
TComponent :IComponent 

Member Data Documentation

◆ Game

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

◆ EntityRef

The Quantum EntityRef that the underlying entity view is attached to.

◆ EntityView

A reference to the parent class to access interesting game and entity data.