Class EntityController
An Entity Controller with extra functionality for the server.
Inherited Members
Namespace: DuneNet.Server.Controllers
Assembly: DuneNet.Server.dll
Syntax
public sealed class EntityController : BaseEntityController
Methods
DestroyAllEntities()
Destroys all spawned entities.
Declaration
public void DestroyAllEntities()
DestroyEntity(Entity)
Destroys a spawned entity.
Declaration
public void DestroyEntity(Entity ent)
Parameters
Type | Name | Description |
---|---|---|
Entity | ent | The enttiy to destroy. |
GetEntities()
Returns all the spawned entities.
Declaration
public IEnumerable<Entity> GetEntities()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Entity> | An IEnumerable instance of type Entity containing all the spawned entities. |
GetEntities<T>()
Returns all the spawned entities of the type specified.
Declaration
public IEnumerable<T> GetEntities<T>()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | An IEnumerable instance of type T containing all the spawned entities of that type. |
Type Parameters
Name | Description |
---|---|
T | The type of the entities to find. Must inherit from Entity |
GetEntitiesForAuthority(NetworkConnection)
Returns all the spawned entities the provided connection has authority over.
Declaration
public IEnumerable<Entity> GetEntitiesForAuthority(NetworkConnection conn)
Parameters
Type | Name | Description |
---|---|---|
NetworkConnection | conn | The authoritative connection for the requested entities. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Entity> | An IEnumerable instance of type Entity containing all the spawned entities. |
GetEntityFromId(UInt32)
Returns a spawned entity identified by its id.
Declaration
public Entity GetEntityFromId(uint entId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | entId | The id of the entity to find. |
Returns
Type | Description |
---|---|
Entity | An instance of Entity representing the requested entity. Null if no such entity was found. |
GetEntityInfo(String)
Returns the registration information of the entity identified by its registration name.
Declaration
public EntityInfo? GetEntityInfo(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The registration name of the entity. |
Returns
Type | Description |
---|---|
System.Nullable<EntityInfo> | If the requested entity was found, an EntityInfo instance containing the information of the registered entity. Null if the requested entity was not found. |
SpawnEntity(String, DuneConnection, Vector3, Quaternion)
Spawns an entity in the current scene.
Declaration
public Entity SpawnEntity(string entName, DuneConnection authorityConnection = null, Vector3 entPos = null, Quaternion entRot = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | entName | The registration name of the entity to spawn. |
DuneConnection | authorityConnection | The connection that will have authority over the entity to spawn. If Null, the server will keep authority over it. |
Vector3 | entPos | The initial position of the entity to spawn. |
Quaternion | entRot | The initial rotation of the entity to spawn. |
Returns
Type | Description |
---|---|
Entity | An instance of Entity representing the spawned entity. |