Quantum 3
3.1.0
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. The view component is not updated (OnUpdateView, OnLateUpdateView) if the behaviour has been disabled. More...
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... | |
| bool | TryGetPredictedFrame (out Frame predictedFrame) |
| Gets the predicted frame, returns false when null. More... | |
| bool | TryGetVerifiedFrame (out Frame verifiedFrame) |
| Gets the verified frame, returns false when null. 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). Can be null after view component ran OnDeactivate. More... | |
| bool | IsActiveAndEnabled => IsActive && this != null && enabled && gameObject != null && gameObject.activeInHierarchy |
Returns true if the view component is IsActive, not null and Behaviour.enabled and the gameObject not null and GameObject.activeInHierarchy. More... | |
| bool | IsGameValid => Game != null |
| Returns true if the Game is not null. More... | |
| Frame | PredictedFrame => Game?.Frames.Predicted |
| The newest predicted frame. Set before calling OnActivate(Frame). Can be null after view component ran OnDeactivate. More... | |
| Frame | PredictedPreviousFrame => Game?.Frames.PredictedPrevious |
| The newest predicted previous frame. Set before calling OnActivate(Frame). Only a separate frame copy when QuantumGameFlags.IsLegacyFrameCopiesEnabled is set, otherwise it is the VerifiedFrame. Can be null after view component ran OnDeactivate. More... | |
| Frame | VerifiedFrame => Game?.Frames.Verified |
| The newest verified frame. Set before calling OnActivate(Frame). Can be null after view component ran OnDeactivate. More... | |
Protected Attributes | |
| QuantumEntityView | _entityView |
Cached entity view is updated during Activate. Can be null after OnDeactivate. More... | |
| QuantumGame | _game |
Cached game object is updated during Activate and GameChanged. Can be null after OnDeactivate. More... | |
Properties | |
| bool | IsActive [get] |
| Is the view component currently activated and not inside the pool or destroyed. More... | |
| bool | IsInitialized [get] |
Returns true if the view component has been initialized. More... | |
| T | 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... | |
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. The view component is not updated (OnUpdateView, OnLateUpdateView) if the behaviour has been disabled.
| T | The type of the custom view context used by this view component. Can be IQuantumEntityViewContext if not required. |
| T | : | IQuantumViewContext |
|
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.
|
inlinevirtual |
Is called when the entity view is activated and the entity was created.
| frame | The frame that the entity was created with, can be predicted or verified base on the QuantumEntityViewBindBehaviour |
.
|
inlinevirtual |
Is called when the view component is deactivated.
|
inlinevirtual |
Is called from the QuantumEntityViewUpdater on a Unity update.
|
inlinevirtual |
Is called from the QuantumEntityViewUpdater on a Unity late update.
|
inlinevirtual |
Is called from the QuantumEntityViewUpdater then the observed game is changed.
|
inline |
Gets the predicted frame, returns false when null.
| predictedFrame | Predicted frame object |
true if the requested frame is not null.
|
inline |
Gets the verified frame, returns false when null.
| verifiedFrame | Verified frame object |
true if the requested frame is not null.
|
inline |
Is only called internally. Sets the view context of this entity view component.
| contexts | All of the different contexts of the EntityViewUpdater, will select the matching type. |
Implements Quantum.IQuantumViewComponent.
|
inline |
Is only called internally. Sets the entity view parent.
| frame | |
| game | |
| entityView |
Implements Quantum.IQuantumViewComponent.
|
inline |
Is only called internally.
Implements Quantum.IQuantumViewComponent.
|
inline |
Is only called internally.
Implements Quantum.IQuantumViewComponent.
|
inline |
Is only called internally.
Implements Quantum.IQuantumViewComponent.
|
inline |
Is only called internally.
Implements Quantum.IQuantumViewComponent.
| virtual QuantumGame Quantum.QuantumViewComponent< T >.Game => _game |
The Game that the entity belongs to. This can change after the OnGameChanged() callback. Set before calling OnActivate(Frame). Can be null after view component ran OnDeactivate.
| Frame Quantum.QuantumViewComponent< T >.PredictedFrame => Game?.Frames.Predicted |
The newest predicted frame. Set before calling OnActivate(Frame). Can be null after view component ran OnDeactivate.
| Frame Quantum.QuantumViewComponent< T >.VerifiedFrame => Game?.Frames.Verified |
The newest verified frame. Set before calling OnActivate(Frame). Can be null after view component ran OnDeactivate.
| Frame Quantum.QuantumViewComponent< T >.PredictedPreviousFrame => Game?.Frames.PredictedPrevious |
The newest predicted previous frame. Set before calling OnActivate(Frame). Only a separate frame copy when QuantumGameFlags.IsLegacyFrameCopiesEnabled is set, otherwise it is the VerifiedFrame. Can be null after view component ran OnDeactivate.
| bool Quantum.QuantumViewComponent< T >.IsActiveAndEnabled => IsActive && this != null && enabled && gameObject != null && gameObject.activeInHierarchy |
Returns true if the view component is IsActive, not null and Behaviour.enabled and the gameObject not null and GameObject.activeInHierarchy.
|
protected |
Cached game object is updated during Activate and GameChanged. Can be null after OnDeactivate.
|
protected |
Cached entity view is updated during Activate. Can be null after OnDeactivate.
| bool Quantum.QuantumViewComponent< T >.IsGameValid => Game != null |
Returns true if the Game is not null.
|
get |
The view context of the QuantumEntityViewUpdater associated with this entity view component.
|
get |
Is the view component currently activated and not inside the pool or destroyed.
|
get |
Returns true if the view component has been initialized.