SpaceRTS - Starter Pack  1.3
NullPointerGame.NavigationSystem.Navigation Class Reference

GameEntityComponent in control of the unit movement. More...

Inheritance diagram for NullPointerGame.NavigationSystem.Navigation:
GameBase.GameEntityComponent NullPointerGame.NavigationSystem.NavMeshNavigation

Classes

class  Data
 Movement configuration for the Navigation component More...
 

Public Member Functions

override void OnVisualModuleSetted ()
 Called when the Visual Module is setted. Here we need to initialize all the component related functionality. More...
 
override void OnVisualModuleRemoved ()
 Called when the Visual Module is removed. Here we need to uninitialize all the component related functionality. More...
 
virtual void Teleport (Vector3 position)
 Instantly teleports the GameEntity to the given position maintaining the looking at direction. More...
 
virtual void Teleport (Vector3 position, Vector3 direction)
 Instantly teleports the GameEntity to the given position and looking at the given direction More...
 
virtual void PrepareToMove (Vector3 position, Vector3 direction)
 Initialize the movement configuration and show the destination marker at its final position. More...
 
virtual void PrepareToPursuit (Transform target, Vector3 offset, Vector3 direction)
 
void ShowMoveMarkerAt (Vector3 pos)
 
virtual void EngageMovement (Action< bool > onEnded=null)
 Confirms the destination setted at PrepareToMove and starts the movement. More...
 
virtual void StopMovement ()
 Stops the current movement at the current position. More...
 
virtual bool IsFinalDestinationReached ()
 Determines whether the movement order is completed because the unit has reached the target position. More...
 
void LateUpdate ()
 
Vector3 Advance (Quaternion targetLookAt, float accel, bool applyMovement=true)
 
bool DoRoll (Quaternion lookAt)
 
void OnDrawGizmosSelected ()
 

Public Attributes

const float AngularSleepThreshold = 2.0f
 
ProxyRef bodyToRoll = new ProxyRef(typeof(Transform), "roll_body")
 
float baseOffset = 0.0f
 The relative vertical displacement of the owning GameObject. More...
 
GameObject moveTargetMarker
 Reference to the child GameObject that'll be used as destination feedback marker. Must contain a MeshRenderer in order to make it visible or hide it when needed. More...
 
float sqrTargetingPrecision = 1.0f
 Square radius of the destination area where the destination target can be considered as reached. Deprecated. Use stoppingDistance instead. More...
 
float speed = 10.0f
 The movement speed that will be used by this navigation. by default, speed will be the max speed (defined in moveConfig.maxSpeed). but you can set with this a slower velocity or a boost for a short time, etc. More...
 
Data moveConfig
 Movement configuration to be used by this component. More...
 
float stoppingDistance = 1.0f
 Stop within this distance from the target position. More...
 
Action DestinationChanged
 
Action DestinationReached
 

Protected Member Functions

virtual void Start ()
 
virtual void OnMovementOrderEngage (Vector3 destination)
 Called after a EngageMovement order. Override to add special behaviours. More...
 
virtual void OnMovementOrderStop ()
 Called when a full stop order was given to this navigation. Override to add special behaviours. More...
 
virtual void OnMovingToDestination ()
 
virtual void OnMoveDestinationReached ()
 
- Protected Member Functions inherited from GameBase.GameEntityComponent
virtual void SetupEntityComponent ()
 virtual class to be implemented. This will be called on the Awake to do a proper initialization of the component ensuring that the GameEntity thisEntity it's already defined at this point. Version 1.1: This will no longer be used in the future. Use instead OnVisualModuleSetted and OnVisualModuleRemoved. More...
 
virtual void OnValidate ()
 Called by unity when the script is reloaded. Here we setup the component and check that all is setted correctly. More...
 
GetSceneSystem< T > ()
 Shortcut for access a SceneSystem registered in the GameScene. More...
 
GetVisualProxyProperty< T > (string name)
 Shortcut for access the property located at the GameEntity visual module. More...
 
void LogsClear ()
 Clears all log messages More...
 
void Log (string message)
 Stores the message as a log that can be used later to show a warning in the editor or console. More...
 
void PushLogs ()
 Push all the stored logs to the console. More...
 

Protected Attributes

Vector3 moveSpeed = Vector3.zero
 

Properties

Vector3 BasePosition [get]
 
Vector3 BaseOffset [get]
 
Vector3 CurrentSpeed [get]
 
float LastAcceleration [get]
 
Vector3 Destination [get]
 
float RemainingDistance [get]
 
Transform BodyToRoll [get]
 Returns the current used transform body where to apply the roll effect. More...
 
- Properties inherited from GameBase.GameEntityComponent
GameEntity ThisEntity [get]
 The GameEntity attached to this component. More...
 
MessageSink Messages [get]
 Shortcut for the Message sink located at the GameEntity attached to this component. More...
 
ComponentProxy VisualProxy [get]
 Shortcut for the ComponentProxy located at the GameEntity attached to this component. More...
 

Detailed Description

GameEntityComponent in control of the unit movement.

Member Function Documentation

◆ Advance()

Vector3 NullPointerGame.NavigationSystem.Navigation.Advance ( Quaternion  targetLookAt,
float  accel,
bool  applyMovement = true 
)

◆ DoRoll()

bool NullPointerGame.NavigationSystem.Navigation.DoRoll ( Quaternion  lookAt)

◆ EngageMovement()

virtual void NullPointerGame.NavigationSystem.Navigation.EngageMovement ( Action< bool >  onEnded = null)
virtual

Confirms the destination setted at PrepareToMove and starts the movement.

Parameters
onEndedCallback to be called when the destination is reached or changed.

◆ IsFinalDestinationReached()

virtual bool NullPointerGame.NavigationSystem.Navigation.IsFinalDestinationReached ( )
virtual

Determines whether the movement order is completed because the unit has reached the target position.

Returns
True if the target position was reached by this unit.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ LateUpdate()

void NullPointerGame.NavigationSystem.Navigation.LateUpdate ( )

◆ OnDrawGizmosSelected()

void NullPointerGame.NavigationSystem.Navigation.OnDrawGizmosSelected ( )

◆ OnMoveDestinationReached()

virtual void NullPointerGame.NavigationSystem.Navigation.OnMoveDestinationReached ( )
protectedvirtual

◆ OnMovementOrderEngage()

virtual void NullPointerGame.NavigationSystem.Navigation.OnMovementOrderEngage ( Vector3  destination)
protectedvirtual

Called after a EngageMovement order. Override to add special behaviours.

Parameters
destinationThe target point in world coordinates where to move the unit.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ OnMovementOrderStop()

virtual void NullPointerGame.NavigationSystem.Navigation.OnMovementOrderStop ( )
protectedvirtual

Called when a full stop order was given to this navigation. Override to add special behaviours.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ OnMovingToDestination()

virtual void NullPointerGame.NavigationSystem.Navigation.OnMovingToDestination ( )
protectedvirtual

◆ OnVisualModuleRemoved()

override void NullPointerGame.NavigationSystem.Navigation.OnVisualModuleRemoved ( )
virtual

Called when the Visual Module is removed. Here we need to uninitialize all the component related functionality.

Reimplemented from GameBase.GameEntityComponent.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ OnVisualModuleSetted()

override void NullPointerGame.NavigationSystem.Navigation.OnVisualModuleSetted ( )
virtual

Called when the Visual Module is setted. Here we need to initialize all the component related functionality.

Reimplemented from GameBase.GameEntityComponent.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ PrepareToMove()

virtual void NullPointerGame.NavigationSystem.Navigation.PrepareToMove ( Vector3  position,
Vector3  direction 
)
virtual

Initialize the movement configuration and show the destination marker at its final position.

Parameters
positionFinal destination of the movement.
directionFinal look at direction for the unit once the destination is reached.

◆ PrepareToPursuit()

virtual void NullPointerGame.NavigationSystem.Navigation.PrepareToPursuit ( Transform  target,
Vector3  offset,
Vector3  direction 
)
virtual

◆ ShowMoveMarkerAt()

void NullPointerGame.NavigationSystem.Navigation.ShowMoveMarkerAt ( Vector3  pos)

◆ Start()

virtual void NullPointerGame.NavigationSystem.Navigation.Start ( )
protectedvirtual

◆ StopMovement()

virtual void NullPointerGame.NavigationSystem.Navigation.StopMovement ( )
virtual

Stops the current movement at the current position.

◆ Teleport() [1/2]

virtual void NullPointerGame.NavigationSystem.Navigation.Teleport ( Vector3  position)
virtual

Instantly teleports the GameEntity to the given position maintaining the looking at direction.

Parameters
positionThe new position where must be located thee game entity.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

◆ Teleport() [2/2]

virtual void NullPointerGame.NavigationSystem.Navigation.Teleport ( Vector3  position,
Vector3  direction 
)
virtual

Instantly teleports the GameEntity to the given position and looking at the given direction

Parameters
positionThe new position where must be located thee game entity.
directionThe new direction that must be looking at the game entity.

Reimplemented in NullPointerGame.NavigationSystem.NavMeshNavigation.

Member Data Documentation

◆ AngularSleepThreshold

const float NullPointerGame.NavigationSystem.Navigation.AngularSleepThreshold = 2.0f

◆ baseOffset

float NullPointerGame.NavigationSystem.Navigation.baseOffset = 0.0f

The relative vertical displacement of the owning GameObject.

◆ bodyToRoll

ProxyRef NullPointerGame.NavigationSystem.Navigation.bodyToRoll = new ProxyRef(typeof(Transform), "roll_body")

◆ DestinationChanged

Action NullPointerGame.NavigationSystem.Navigation.DestinationChanged

◆ DestinationReached

Action NullPointerGame.NavigationSystem.Navigation.DestinationReached

◆ moveConfig

Data NullPointerGame.NavigationSystem.Navigation.moveConfig

Movement configuration to be used by this component.

◆ moveSpeed

Vector3 NullPointerGame.NavigationSystem.Navigation.moveSpeed = Vector3.zero
protected

◆ moveTargetMarker

GameObject NullPointerGame.NavigationSystem.Navigation.moveTargetMarker

Reference to the child GameObject that'll be used as destination feedback marker. Must contain a MeshRenderer in order to make it visible or hide it when needed.

◆ speed

float NullPointerGame.NavigationSystem.Navigation.speed = 10.0f

The movement speed that will be used by this navigation. by default, speed will be the max speed (defined in moveConfig.maxSpeed). but you can set with this a slower velocity or a boost for a short time, etc.

◆ sqrTargetingPrecision

float NullPointerGame.NavigationSystem.Navigation.sqrTargetingPrecision = 1.0f

Square radius of the destination area where the destination target can be considered as reached. Deprecated. Use stoppingDistance instead.

◆ stoppingDistance

float NullPointerGame.NavigationSystem.Navigation.stoppingDistance = 1.0f

Stop within this distance from the target position.

Property Documentation

◆ BaseOffset

Vector3 NullPointerGame.NavigationSystem.Navigation.BaseOffset
get

◆ BasePosition

Vector3 NullPointerGame.NavigationSystem.Navigation.BasePosition
get

◆ BodyToRoll

Transform NullPointerGame.NavigationSystem.Navigation.BodyToRoll
getprotected

Returns the current used transform body where to apply the roll effect.

◆ CurrentSpeed

Vector3 NullPointerGame.NavigationSystem.Navigation.CurrentSpeed
get

◆ Destination

Vector3 NullPointerGame.NavigationSystem.Navigation.Destination
get

◆ LastAcceleration

float NullPointerGame.NavigationSystem.Navigation.LastAcceleration
get

◆ RemainingDistance

float NullPointerGame.NavigationSystem.Navigation.RemainingDistance
get