Class ObserverCondition
Condition a connection must meet to be added as an observer. This class can be inherited from for custom conditions.
Inheritance
Implements
Inherited Members
Namespace: FishNet.Observing
Assembly: FishNet.Runtime.dll
Syntax
public abstract class ObserverCondition : ScriptableObject, IOrderable
Fields
NetworkObject
NetworkObject this condition is for.
Declaration
[HideInInspector]
public NetworkObject NetworkObject
Field Value
| Type | Description |
|---|---|
| NetworkObject |
Properties
Order
Order in which conditions are added to the NetworkObserver. Lower values will added first, resulting in the condition being checked first. Timed conditions will never check before non-timed conditions.
Declaration
public int Order { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
ConditionMet(NetworkConnection, Boolean, out Boolean)
Returns if the object which this condition resides should be visible to connection.
Declaration
public abstract bool ConditionMet(NetworkConnection connection, bool currentlyAdded, out bool notProcessed)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkConnection | connection | Connection which the condition is being checked for. |
| System.Boolean | currentlyAdded | True if the connection currently has visibility of this object. |
| System.Boolean | notProcessed | True if the condition was not processed. This can be used to skip processing for performance. While output as true this condition result assumes the previous ConditionMet value. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Deinitialize(Boolean)
Deinitializes this script.
Declaration
public virtual void Deinitialize(bool destroyed)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | destroyed | True if the object is being destroyed, false if being despawned. An object may deinitialize for despawn, then destroy after. |
GetConditionType()
Type of condition this is. Certain types are handled different, such as Timed which are checked for changes at timed intervals.
Declaration
public abstract ObserverConditionType GetConditionType()
Returns
| Type | Description |
|---|---|
| ObserverConditionType |
GetIsEnabled()
Gets the enabled state of this condition.
Declaration
public bool GetIsEnabled()
Returns
| Type | Description |
|---|---|
| System.Boolean |
Initialize(NetworkObject)
Initializes this script for use.
Declaration
public virtual void Initialize(NetworkObject networkObject)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkObject | networkObject | NetworkObject this condition is initializing for. |
SetIsEnabled(Boolean)
Sets the enabled state of this condition. If the state has changed observers will be rebuilt for this object.
Declaration
public void SetIsEnabled(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | value |