SpaceRTS - Starter Pack  1.3
NullPointerGame.Spatial.SpatialSystem Class Reference

Act as a Manager for the spatial Navigation of the map. Can be overrided to allow different Navigation methods like the Unity's built-in NavMesh system or A* Pathfinding project. More...

Inheritance diagram for NullPointerGame.Spatial.SpatialSystem:
GameBase.GameSceneSystem NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem

Public Member Functions

virtual string [] GetAreaNames ()
 Returns the list of area names (useful for editor classes to display an int field mask with the proper layer names). Returning null implies that the current NavMesh layer names must be used. More...
 
virtual bool SamplePosition (Vector3 pingPosition, out Vector3 closestPoint, int masks)
 Finds the closest point into the navigation area. More...
 
virtual bool GetClosestEdgeDistance (Vector3 pingPosition, out float distance, int masks)
 Locate the closest edge distance from a point on the Navigation spatial areas. More...
 
virtual bool GetClosestEdgePosition (Vector3 pingPosition, out Vector3 edgePosition, int masks)
 Locate the closest edge position from a point on the Navigation spatial areas. More...
 
void Rebuild ()
 Forces to rebuild the entire spatial system. This method only marks the system as a rebuild required, the actual rebuild will be done at the of the frame so multiple calls to this function can be made without overhead penalty. More...
 
bool IsRebuilding ()
 
void StopRebuild ()
 
virtual void AddVolumeModifiers (IEnumerable< SpatialModifier > addedModifiers)
 Registers a bunch of SpatialModifiers that will shape the navigation areas of this SpatialSystem after a rebuild. More...
 
virtual void RemoveVolumeModifiers (IEnumerable< SpatialModifier > removedModifiers)
 Unregisters a bunch of SpatialModifiers from the SpatialSystem. More...
 
- Public Member Functions inherited from GameBase.GameSceneSystem
virtual void GenerateDefaultValues ()
 

Public Attributes

Action< SpatialModifierOnSpatialModifierAdded
 Action delegate called every time a SpatialModifier is registered More...
 
Action< SpatialModifierOnSpatialModifierRemoved
 Action delegate called every time a SpatialModifier is unregistered More...
 
Action OnRebuildCompleted
 Action dellegate called every time a rebuild is completed. More...
 

Protected Member Functions

virtual IEnumerator OnRebuild ()
 Called along with the rebuild process. Should be overriden to implement a custon rebuild process. More...
 
- Protected Member Functions inherited from GameBase.GameSceneSystem
virtual void OnValidate ()
 Finds the GameScene in the current hierarchy going from parent to parent. Also registers the scene system in that GameScene. More...
 
virtual void Reset ()
 
virtual void ValidateSceneSystem ()
 

Protected Attributes

List< SpatialModifiermodifiers = new List<SpatialModifier>()
 

Properties

virtual int DefaultAllAreasMask [get]
 Default value when all areas must be marked in a AreaMask More...
 
IEnumerable< SpatialModifierModifiers [get]
 Creates an enumeration of each SpatialModifier that should shape the navigation areas of the spatial system. TODO: I'm pretty sure that a lot of optimizations can be done here. I'll mark it as a big TODO and come back later to this. More...
 
- Properties inherited from GameBase.GameSceneSystem
GameScene gameScene [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from GameBase.GameSceneSystem
static bool ValidateExists< T > (UnityEngine.Object context)
 
static void CreateDefault< T > (UnityEngine.Object context)
 
static T Find< T > (UnityEngine.Object context)
 
static T GetValid< T > (UnityEngine.Object context)
 

Detailed Description

Act as a Manager for the spatial Navigation of the map. Can be overrided to allow different Navigation methods like the Unity's built-in NavMesh system or A* Pathfinding project.

Member Function Documentation

◆ AddVolumeModifiers()

virtual void NullPointerGame.Spatial.SpatialSystem.AddVolumeModifiers ( IEnumerable< SpatialModifier addedModifiers)
virtual

Registers a bunch of SpatialModifiers that will shape the navigation areas of this SpatialSystem after a rebuild.

Parameters
addedModifiersAn enumeration of the SpatialModifiers that need to be registered.

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ GetAreaNames()

virtual string [] NullPointerGame.Spatial.SpatialSystem.GetAreaNames ( )
virtual

Returns the list of area names (useful for editor classes to display an int field mask with the proper layer names). Returning null implies that the current NavMesh layer names must be used.

Returns
A string array will a the layer area names for the spatial system.

◆ GetClosestEdgeDistance()

virtual bool NullPointerGame.Spatial.SpatialSystem.GetClosestEdgeDistance ( Vector3  pingPosition,
out float  distance,
int  masks 
)
virtual

Locate the closest edge distance from a point on the Navigation spatial areas.

Parameters
pingPositionThe origin of the distance query.
distanceHolds the resulting distance.
masksA bitfield mask specifying which areas can be passed when finding the nearest edge.
Returns
True if a nearest edge is found.

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ GetClosestEdgePosition()

virtual bool NullPointerGame.Spatial.SpatialSystem.GetClosestEdgePosition ( Vector3  pingPosition,
out Vector3  edgePosition,
int  masks 
)
virtual

Locate the closest edge position from a point on the Navigation spatial areas.

Parameters
pingPositionThe origin of the distance query.
edgePositionHolds the resulting position.
masksA bitfield mask specifying which areas can be passed when finding the nearest edge.
Returns
True if a nearest edge is found.

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ IsRebuilding()

bool NullPointerGame.Spatial.SpatialSystem.IsRebuilding ( )

◆ OnRebuild()

virtual IEnumerator NullPointerGame.Spatial.SpatialSystem.OnRebuild ( )
protectedvirtual

Called along with the rebuild process. Should be overriden to implement a custon rebuild process.

Returns

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ Rebuild()

void NullPointerGame.Spatial.SpatialSystem.Rebuild ( )

Forces to rebuild the entire spatial system. This method only marks the system as a rebuild required, the actual rebuild will be done at the of the frame so multiple calls to this function can be made without overhead penalty.

◆ RemoveVolumeModifiers()

virtual void NullPointerGame.Spatial.SpatialSystem.RemoveVolumeModifiers ( IEnumerable< SpatialModifier removedModifiers)
virtual

Unregisters a bunch of SpatialModifiers from the SpatialSystem.

Parameters
removedModifiersThe enumeration of SpatialModifiers that need to be unregistered.

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ SamplePosition()

virtual bool NullPointerGame.Spatial.SpatialSystem.SamplePosition ( Vector3  pingPosition,
out Vector3  closestPoint,
int  masks 
)
virtual

Finds the closest point into the navigation area.

Parameters
pingPositionThe origin of the sample query.
closestPointthe resulting location.
masksA mask specifying which areas are allowed when finding the nearest point.
Returns
True if a nearest point is found.

Reimplemented in NullPointerGame.NavMeshIntegration.NavMeshSpatialSystem.

◆ StopRebuild()

void NullPointerGame.Spatial.SpatialSystem.StopRebuild ( )

Member Data Documentation

◆ modifiers

List<SpatialModifier> NullPointerGame.Spatial.SpatialSystem.modifiers = new List<SpatialModifier>()
protected

◆ OnRebuildCompleted

Action NullPointerGame.Spatial.SpatialSystem.OnRebuildCompleted

Action dellegate called every time a rebuild is completed.

◆ OnSpatialModifierAdded

Action<SpatialModifier> NullPointerGame.Spatial.SpatialSystem.OnSpatialModifierAdded

Action delegate called every time a SpatialModifier is registered

◆ OnSpatialModifierRemoved

Action<SpatialModifier> NullPointerGame.Spatial.SpatialSystem.OnSpatialModifierRemoved

Action delegate called every time a SpatialModifier is unregistered

Property Documentation

◆ DefaultAllAreasMask

virtual int NullPointerGame.Spatial.SpatialSystem.DefaultAllAreasMask
get

Default value when all areas must be marked in a AreaMask

◆ Modifiers

IEnumerable<SpatialModifier> NullPointerGame.Spatial.SpatialSystem.Modifiers
get

Creates an enumeration of each SpatialModifier that should shape the navigation areas of the spatial system. TODO: I'm pretty sure that a lot of optimizations can be done here. I'll mark it as a big TODO and come back later to this.