Class Entity
A client entity.
Implements
Inherited Members
Namespace: DuneNet.Client.Entities
Assembly: DuneNet.Client.dll
Syntax
public abstract class Entity : BaseEntity, IEventCompatible
Properties
HasAuthority
True if the entity has local authority, False otherwise.
Declaration
public bool HasAuthority { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
StateCount
The amount of movement states that have not been processed yet.
Declaration
public int StateCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This will always be Zero if the entity is clientside or its movement is not being synchronized.
UMessages
A dictionary containing all the current User Messages and their values.
Declaration
public Dictionary<string, object> UMessages { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
Remarks
Used for display and debug purposes. For normal operation, use SetUMessage and GetUMessage.
Methods
Awake()
Declaration
protected override sealed void Awake()
Overrides
FixedUpdate()
Declaration
protected override sealed void FixedUpdate()
Overrides
GetNetworkedVar<T>(String)
Returns the specified Networked Variable's value.
Declaration
public T GetNetworkedVar<T>(string varName)
Parameters
Type | Name | Description |
---|---|---|
System.String | varName | The name of the Networked Variable to obtain. |
Returns
Type | Description |
---|---|
T | An instance of type T representing the value of the Networked Variable. If the Networked Variable does not exist, the default value of T is returned instead. |
Type Parameters
Name | Description |
---|---|
T | The type of the Networked Variable to obtain. It must flagged as Serializable. |
Remarks
Networked Variables are unidirectional: they are set by the server and synchronized to all clients that can observe the entity.
GetUMessage<T>(String)
Returns the specified User Message's value.
Declaration
public T GetUMessage<T>(string varName)
Parameters
Type | Name | Description |
---|---|---|
System.String | varName | The name of the User Message to obtain. |
Returns
Type | Description |
---|---|
T | An instance of type T representing the value of the User Message. If the User Message does not exist, the default value of T is returned instead. |
Type Parameters
Name | Description |
---|---|
T | The type of the User Message to obtain. It must flagged as Serializable. |
Remarks
User Messages are unidirectional: they are set by a client and synchronized to to the server. Only clients with authority over the entity may set its User Messages. Clientside entities do not support User Messages since they are not networked.
LateUpdate()
Declaration
protected override sealed void LateUpdate()
Overrides
OnNetUpdate()
Overridable method called once every network update.
Declaration
protected virtual void OnNetUpdate()
Remarks
How often this method gets called depends on the network tickrate of the entity (by default, 33 times per second). This method is called before any synchronization takes place. The entity should update its User Messages here since this is the fastest they will be synchronized.
OnSetNetVar(String)
Overridable method called when the server updates any of the Networked Variables of the entity.
Declaration
protected virtual void OnSetNetVar(string varName)
Parameters
Type | Name | Description |
---|---|---|
System.String | varName | The name of the Networked Variable that was received from the server. |
Remarks
For entities with a large amount of Networked Variables, it is advisable to switch over varName.
RegisterEventInstance()
Declaration
public void RegisterEventInstance()
SetParent(BaseEntity)
Sets the parent of the entity.
Declaration
public override void SetParent(BaseEntity newParent)
Parameters
Type | Name | Description |
---|---|---|
BaseEntity | newParent | The entity the parent will be se to. |
Overrides
SetPos(Vector3)
Sets the position of the entity.
Declaration
public override void SetPos(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The position to set the entity to. |
SetRot(Quaternion)
Sets the rotation of the entity.
Declaration
public override void SetRot(Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | rotation | The rotation to set the entity to. |
SetUMessage(String, Object)
Sets the specified User Message's value.
Declaration
public void SetUMessage(string varName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | varName | The name of the User Message to set. |
System.Object | value | The value to set the User Message to. |
Remarks
User Messages are unidirectional: they are set by a client and synchronized to the server. Only clients with authority over the entity may set its User Messages. Clientside entities do not support User Messages since they are not networked.
Start()
Declaration
protected override sealed void Start()
Overrides
Update()
Declaration
protected override sealed void Update()