Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Public Attributes | Protected Member Functions | Properties | Events | List of all members
Chunks.Agents.GroundAgent Class Reference

Handles movement for agents that travel on the ground. More...

Inheritance diagram for Chunks.Agents.GroundAgent:
Chunks.Entities.Component Chunks.Entities.Object Chunks.Entities.IComponent Chunks.Entities.IObject

Public Member Functions

 GroundAgent ()
 
void StartMoving ()
 Starts moving the agent towards the previously assigned destination. More...
 
void StartMoving (Vector destination)
 Starts moving the agent towards the given destination. More...
 
void StopMoving ()
 Stops the agent from moving. More...
 
void Jump ()
 Attempts to make the agent jump, only succeeds if the agent is grounded. More...
 
- Public Member Functions inherited from Chunks.Entities.Component
void DestroyComponent ()
 Removes this component from the entity that contains it. More...
 
void DestroyEntity ()
 Removes the entity containing this component from the world, along with any child entities. More...
 
override string ToString ()
 Returns a string representing this component with the format "TypeName (EntityName)." More...
 
- Public Member Functions inherited from Chunks.Entities.Object
Entity CreateChild ()
 Creates a new Entity parented to this one. More...
 
TComponent CreateChildWithComponent< TComponent > ()
 Creates a new Entity parented to this one with a component of the given type, which is returned. More...
 
Entity FindChild (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. Null is returned if no matches are found. More...
 
TComponent FindChildComponent< TComponent > (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. If a matching Entity is found, a component of the given type is retrieved from it. Null is returned if no matches are found. More...
 
Entity FindParent (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > ()
 Attempts to find an Entity that contains this Object's Entity with a component of the given type. If a matching Entity is found, the component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. If a matching Entity is found, a component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent AddComponent< TComponent > ()
 Adds a component of the specified type to this entity, returning the new component. More...
 
TComponent GetOrAddComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, adding it if one doesn't already exist. More...
 
TComponent GetComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, returning null if one doesn't exist. More...
 
IEnumerable< TComponent > GetComponents< TComponent > ()
 Gets all components derived from the given type. More...
 

Public Attributes

const float DefaultMoveSpeed = 0.25f
 Default maximum speed the agent can accelerate to. More...
 
const float DefaultMoveAcceleration = 1f
 Default maximum rate of change of velocity. More...
 
const float DefaultStopMovingDistance = 1f/32f
 The default maximum distance from the agent's destination that it will consider the destination reached. More...
 
const float DefaultTurnSpeed = 270f
 Default maximum turning speed. More...
 
const float DefaultJumpVelocity = 1f
 The default vertical velocity gained by the agent when jumping. More...
 
- Public Attributes inherited from Chunks.Entities.Component
override bool IsValid => Behaviour != null
 Tests to see if this component hasn't been removed. More...
 

Protected Member Functions

override void OnInitialize ()
 Called only once, when the component is first attached to an entity and is ready to add or retrieve other components. More...
 
override void OnUpdate ()
 Called once per world update if this component and its parent entity are enabled. More...
 
override void OnPhysicsUpdate ()
 Called at a fixed time step for any time dependant physics calculations. More...
 
- Protected Member Functions inherited from Chunks.Entities.Component
object Wait (float timeSeconds)
 Suspends coroutine operation for the given time when yielded. More...
 
object StartCoroutine (IEnumerator routine)
 Starts execution of a coroutine. More...
 
virtual void OnSave (BinaryWriter writer)
 Implement this and OnLoad to enable serialization of this component when the parent entity saves. More...
 
virtual void OnLoad (BinaryReader reader)
 Implement this and OnSave to enable serialization of this component when the parent entity saves. More...
 
virtual void OnEnable ()
 Called each time this component goes from being disabled to enabled. More...
 
virtual void OnDisable ()
 Called each time this component goes from being enabled to disabled. More...
 
virtual void OnDestroy ()
 Called when this component is removed, or the parent entity is destroyed. More...
 
virtual void OnPreRender ()
 Called just before the entity containing this component is rendered. More...
 

Properties

AABBPhysics Physics [get]
 Physics component used by the agent to move. More...
 
float MoveSpeed [get, set]
 Maximum speed the agent can accelerate to. More...
 
float MoveAcceleration [get, set]
 Maximum rate of change of velocity. More...
 
float StopMovingDistance [get, set]
 The maximum distance from the agent's destination that it will consider the destination reached. More...
 
float TurnSpeed [get, set]
 Maximum turning speed. More...
 
float JumpVelocity [get, set]
 The vertical velocity gained by the agent when jumping. More...
 
bool IsMoving [get]
 If true, the agent will attempt to make its way towards a destination. More...
 
Vector Destination [get, set]
 Current goal position to travel to. More...
 
- Properties inherited from Chunks.Entities.Component
Entity Entity [get]
 The entity this instance is attached to. More...
 
bool IsSavingImplemented [get]
 If true, OnSave and OnLoad have been implemented for this type. More...
 
bool Enabled [get, set]
 Enabled components will be updated, assuming they are within enabled entities. More...
 
- Properties inherited from Chunks.Entities.Object
abstract bool IsValid [get]
 Tests to see if this object hasn't been removed. More...
 
virtual string Name [get, set]
 Custom name associated with this Object's Entity, used to find the Entity in the hierarchy. More...
 
virtual Transform Transform [get]
 Transformation of this Object's Entity. More...
 
virtual IWorld World [get]
 The IWorld that contains this Object. More...
 
- Properties inherited from Chunks.Entities.IComponent
Entity Entity [get]
 
bool IsSavingImplemented [get]
 
bool Enabled [get, set]
 
- Properties inherited from Chunks.Entities.IObject
bool IsValid [get]
 
string Name [get, set]
 
Transform Transform [get]
 
IWorld World [get]
 

Events

GroundAgentEventHandler StartedMoving
 Invoked when the agent starts moving towards a destination. More...
 
GroundAgentEventHandler StoppedMoving
 Invoked when the agent stops moving towards a destination. More...
 

Detailed Description

Handles movement for agents that travel on the ground.

Constructor & Destructor Documentation

Chunks.Agents.GroundAgent.GroundAgent ( )

Member Function Documentation

void Chunks.Agents.GroundAgent.Jump ( )

Attempts to make the agent jump, only succeeds if the agent is grounded.

override void Chunks.Agents.GroundAgent.OnInitialize ( )
protectedvirtual

Called only once, when the component is first attached to an entity and is ready to add or retrieve other components.

Reimplemented from Chunks.Entities.Component.

override void Chunks.Agents.GroundAgent.OnPhysicsUpdate ( )
protectedvirtual

Called at a fixed time step for any time dependant physics calculations.

Reimplemented from Chunks.Entities.Component.

override void Chunks.Agents.GroundAgent.OnUpdate ( )
protectedvirtual

Called once per world update if this component and its parent entity are enabled.

Reimplemented from Chunks.Entities.Component.

void Chunks.Agents.GroundAgent.StartMoving ( )

Starts moving the agent towards the previously assigned destination.

void Chunks.Agents.GroundAgent.StartMoving ( Vector  destination)

Starts moving the agent towards the given destination.

Parameters
destinationDestination to move to
void Chunks.Agents.GroundAgent.StopMoving ( )

Stops the agent from moving.

Member Data Documentation

const float Chunks.Agents.GroundAgent.DefaultJumpVelocity = 1f

The default vertical velocity gained by the agent when jumping.

const float Chunks.Agents.GroundAgent.DefaultMoveAcceleration = 1f

Default maximum rate of change of velocity.

const float Chunks.Agents.GroundAgent.DefaultMoveSpeed = 0.25f

Default maximum speed the agent can accelerate to.

const float Chunks.Agents.GroundAgent.DefaultStopMovingDistance = 1f/32f

The default maximum distance from the agent's destination that it will consider the destination reached.

const float Chunks.Agents.GroundAgent.DefaultTurnSpeed = 270f

Default maximum turning speed.

Property Documentation

Vector Chunks.Agents.GroundAgent.Destination
getset

Current goal position to travel to.

bool Chunks.Agents.GroundAgent.IsMoving
get

If true, the agent will attempt to make its way towards a destination.

float Chunks.Agents.GroundAgent.JumpVelocity
getset

The vertical velocity gained by the agent when jumping.

float Chunks.Agents.GroundAgent.MoveAcceleration
getset

Maximum rate of change of velocity.

float Chunks.Agents.GroundAgent.MoveSpeed
getset

Maximum speed the agent can accelerate to.

AABBPhysics Chunks.Agents.GroundAgent.Physics
get

Physics component used by the agent to move.

float Chunks.Agents.GroundAgent.StopMovingDistance
getset

The maximum distance from the agent's destination that it will consider the destination reached.

float Chunks.Agents.GroundAgent.TurnSpeed
getset

Maximum turning speed.

Event Documentation

GroundAgentEventHandler Chunks.Agents.GroundAgent.StartedMoving

Invoked when the agent starts moving towards a destination.

GroundAgentEventHandler Chunks.Agents.GroundAgent.StoppedMoving

Invoked when the agent stops moving towards a destination.


The documentation for this class was generated from the following file: