Netick.NetworkBehaviour Class Reference
Inheritance diagram for Netick.NetworkBehaviour:
Netick.NetickBehaviour Netick.NetworkAnimator Netick.NetworkTransform Netick.NetworkRigidbody Netick.NetworkRigidbody2D

Public Member Functions

virtual void NetworkReset ()
 
virtual void OnInputPermitted ()
 
virtual void OnInputRevoked ()
 
virtual void OnInputSourceLeft ()
 
virtual void ApplyToBehaviour ()
 
virtual void ApplyToComponent ()
 
virtual void BeforeSetup ()
 
bool FetchInput< T > (out T input)
 
Interpolator< T > FindInterpolator< T > (int id)
 
bool CanSend (RpcPeers source, RpcPeers target)
 
bool CanInvoke (RpcPeers source, RpcPeers target, bool localInvoke)
 
virtual void InitProperties ()
 
void AddArray (nArray array)
 
NetworkVariable AddProperty (NetworkVariable property, bool isInterpolated, bool isPredicted)
 
- Public Member Functions inherited from Netick.NetickBehaviour
virtual void NetworkStart ()
 
virtual void NetworkDestroy ()
 
virtual void NetworkUpdate ()
 
virtual void NetworkRender ()
 
virtual void NetworkFixedUpdate ()
 

Properties

int Id [get]
 
bool IsClient [get]
 
bool IsServer [get]
 
bool IsOwner [get]
 
bool IsInputSource [get]
 
bool IsProxy [get]
 
bool IsResimulating [get]
 
NetworkPlayer InputSource [get]
 
float UpdatePeriod [get]
 
virtual int UpdateFactor [get]
 
- Properties inherited from Netick.NetickBehaviour
NetworkSandbox Sandbox [get, set]
 
NetworkObject Object [get, set]
 

Detailed Description

Network Behaviour is the base class for all behaviours that need to be networked.

Member Function Documentation

◆ AddArray()

void Netick.NetworkBehaviour.AddArray ( nArray  array)

Internal method. Never call this.

◆ AddProperty()

NetworkVariable Netick.NetworkBehaviour.AddProperty ( NetworkVariable  property,
bool  isInterpolated,
bool  isPredicted 
)

Internal method. Never call this.

◆ ApplyToBehaviour()

virtual void Netick.NetworkBehaviour.ApplyToBehaviour ( )
virtual

Overrides this to apply the Unity's component state into the network state (network properties) of this NetworkBehaviour.

Reimplemented in Netick.NetworkAnimator, Netick.NetworkRigidbody, Netick.NetworkRigidbody2D, and Netick.NetworkTransform.

◆ ApplyToComponent()

virtual void Netick.NetworkBehaviour.ApplyToComponent ( )
virtual

Overrides this to apply the network state (network properties) of this NetworkBehaviour into the Unity's component state.

Reimplemented in Netick.NetworkAnimator, Netick.NetworkRigidbody, Netick.NetworkRigidbody2D, and Netick.NetworkTransform.

◆ BeforeSetup()

virtual void Netick.NetworkBehaviour.BeforeSetup ( )
virtual

◆ CanInvoke()

bool Netick.NetworkBehaviour.CanInvoke ( RpcPeers  source,
RpcPeers  target,
bool  localInvoke 
)

Internal method. Never call this.

◆ CanSend()

bool Netick.NetworkBehaviour.CanSend ( RpcPeers  source,
RpcPeers  target 
)

Internal method. Never call this.

◆ FetchInput< T >()

bool Netick.NetworkBehaviour.FetchInput< T > ( out T  input)

Fetchs a NetworkInput for this tick. Returns false if no input source is currently providing inputs to this Object, or when input loss occurs (in case of a remote input source).

Type Constraints
T :NetworkInput 

◆ FindInterpolator< T >()

Interpolator< T > Netick.NetworkBehaviour.FindInterpolator< T > ( int  id)

Finds a property interpolator by Id. You should call this in NetworkStart, and store your interpolator in a variable - because calling this repeatedly is slow.

Template Parameters
TProperty type
Parameters
idInterpolator id
Returns
Interpolator of the property
Type Constraints
T :struct 

◆ InitProperties()

virtual void Netick.NetworkBehaviour.InitProperties ( )
virtual

Internal method. Never call this.

◆ NetworkReset()

virtual void Netick.NetworkBehaviour.NetworkReset ( )
virtual

Called when this Object (which's part of a networked prefab) has been recycled. It's used to reset the state of networked prefabs for reuse later. Make sure to reset the object correctly.

Note: all network properties are auto-rest to their declaration value by Netick. Therefore, you only need to rest non-networked fields which need to be rest.

Note: this is only called if pooling is activated for this prefab.

◆ OnInputPermitted()

virtual void Netick.NetworkBehaviour.OnInputPermitted ( )
virtual

Called when this NetworkSandbox.LocalPlayer has been granted permission to provide inputs to this Object.

◆ OnInputRevoked()

virtual void Netick.NetworkBehaviour.OnInputRevoked ( )
virtual

Called when this NetworkSandbox.LocalPlayer has been revoked from providing inputs to this Object.

◆ OnInputSourceLeft()

virtual void Netick.NetworkBehaviour.OnInputSourceLeft ( )
virtual

Called on the server when the input source of this Object has disconnected.

Property Documentation

◆ Id

int Netick.NetworkBehaviour.Id
get

The network id of this NetworkBehaviour.

◆ InputSource

NetworkPlayer Netick.NetworkBehaviour.InputSource
get

Returns the source NetworkPlayer (NetworkPeer/ServerConnection) of inputs for this NetworkObject. If the source of inputs is remote (from a client) it returns that ServerConnection, while on the input source itself it returns the local NetworkPlayer.

◆ IsClient

bool Netick.NetworkBehaviour.IsClient
get

Returns true if this Sandbox is a client.

◆ IsInputSource

bool Netick.NetworkBehaviour.IsInputSource
get

Returns true if this NetworkSandbox.LocalPlayer is providing inputs to this Object.

◆ IsOwner

bool Netick.NetworkBehaviour.IsOwner
get

Returns true if this Sandbox is the owner of this Object. In this version of Netick: Server=Owner.

◆ IsProxy

bool Netick.NetworkBehaviour.IsProxy
get

Returns true if we neither provide inputs nor own this Object.

◆ IsResimulating

bool Netick.NetworkBehaviour.IsResimulating
get

Returns true if we are currently resimulating a previous input of the past. On the server, it always returns false since only the clients resimulate.

◆ IsServer

bool Netick.NetworkBehaviour.IsServer
get

Returns true if this Sandbox is the server.

◆ UpdateFactor

virtual int Netick.NetworkBehaviour.UpdateFactor
get

◆ UpdatePeriod

float Netick.NetworkBehaviour.UpdatePeriod
get