Class BaseEntity
A base entity.
Namespace: DuneNet.Shared.Entities
Assembly: DuneNet.Shared.dll
Syntax
public abstract class BaseEntity : MonoBehaviour
Fields
DirtyBit
Declaration
protected bool DirtyBit
Field Value
Type | Description |
---|---|
System.Boolean |
EntId
The ID of the entity. Null if the entity is not networked.
Declaration
public uint? EntId
Field Value
Type | Description |
---|---|
System.Nullable<System.UInt32> |
EntName
The registration name of the entity.
Declaration
public string EntName
Field Value
Type | Description |
---|---|
System.String |
EntType
The reflection type of the entity.
Declaration
public Type EntType
Field Value
Type | Description |
---|---|
System.Type |
IsEntitySpawned
Whether the entity has been spawned. True if it has been spawned, False otherwise.
Declaration
public bool IsEntitySpawned
Field Value
Type | Description |
---|---|
System.Boolean |
NetUpdateInterval
The network tickrate of the entity. This is how often (in seconds) the entity is synchronized. By default this is set to 0.030s, which means 33 times per second
Declaration
public float NetUpdateInterval
Field Value
Type | Description |
---|---|
System.Single |
NetUpdateTime
Declaration
protected float NetUpdateTime
Field Value
Type | Description |
---|---|
System.Single |
Methods
Awake()
Declaration
protected virtual void Awake()
FixedUpdate()
Declaration
protected virtual void FixedUpdate()
LateUpdate()
Declaration
protected virtual void LateUpdate()
OnAwake()
Overridable method called when the instance is being loaded.
Declaration
protected virtual void OnAwake()
OnEntityDestroyed()
Overridable method called when the entity is destroyed.
Declaration
protected virtual void OnEntityDestroyed()
OnEntityDestroyedInternal()
Declaration
protected virtual void OnEntityDestroyedInternal()
OnEntitySpawned()
Overridable method called when the entity is spawned.
Declaration
protected virtual void OnEntitySpawned()
OnFixedUpdate()
Overridable method called every fixed framerate frame, if the DuneMonobehaviour is enabled.
Declaration
protected virtual void OnFixedUpdate()
OnLateUpdate()
Overridable method called every frame, if the DuneMonobehaviour is enabled.
Declaration
protected virtual void OnLateUpdate()
OnSetParent(BaseEntity)
Overridable method called when the entity's parent is changed.
Declaration
protected virtual void OnSetParent(BaseEntity newParent)
Parameters
Type | Name | Description |
---|---|---|
BaseEntity | newParent | The new parent of the entity. |
OnSetPos(Vector3, Vector3)
Overridable method called when the entity's position is changed.
Declaration
protected virtual void OnSetPos(Vector3 oldPos, Vector3 newPos)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | oldPos | The position before the entity was moved. |
Vector3 | newPos | The position after the entity has been moved. |
OnSetRot(Quaternion, Quaternion)
Overridable method called when the entity's rotation is changed.
Declaration
protected virtual void OnSetRot(Quaternion oldRot, Quaternion newRot)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | oldRot | The rotation before the entity was moved. |
Quaternion | newRot | The rotation after the entity has been moved. |
OnStart()
Overridable method called on the frame when the instance is enabled just before any of the Update methods is called the first time.
Declaration
protected virtual void OnStart()
OnUpdate()
Overridable method called called every frame, if the DuneMonobehaviour is enabled.
Declaration
protected virtual void OnUpdate()
SetParent(BaseEntity)
Sets the parent of the entity and sends it to all ready clients.
Declaration
public virtual void SetParent(BaseEntity newParent)
Parameters
Type | Name | Description |
---|---|---|
BaseEntity | newParent | The entity the parent will be se to. |
SetPos(Vector3)
Sets the position of the entity and sends it to all ready clients.
Declaration
public virtual 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 and sends it to all ready clients.
Declaration
public virtual void SetRot(Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | rotation | The rotation to set the entity to. |
Start()
Declaration
protected virtual void Start()
Update()
Declaration
protected virtual void Update()