Targeting System 2.0.0
Plugin for multipurpose targeting and visual effects.
Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem Class Reference

Class that shows up as a targeting system controller for the user. Main class for using the targeting system plugin. More...

Inheritance diagram for Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem:

Public Member Functions

int CompareTo (GV_TargetingSystem other)
 
Target GetClosestTarget (bool forceUpdate)
 Gets closest entity or gameObject as target according to parameters set by the user from GV_TargetingSystem component. More...
 
GameObject GetClosestTargetAsGameObject (bool forceUpdate)
 Gets closest gameObject, if none return null. More...
 
Target GetMostDistantTarget (bool forceUpdate)
 Gets closest entity or gameObject as target according to parameters set by the user from GV_TargetingSystem component. If there is no targets it tries to first update the closest target list. More...
 
NativeSlice< TargetGetClosestTargets (bool forceUpdate)
 Gets targets for both entities and GameObject. Then sorts them. More...
 
NativeSlice< TargetGetClosestTargets (bool forceUpdate, bool coldStart)
 Gets targets for both entities and GameObject. Then sorts them. More...
 
List< Type > GetQueryComponentsFromTargetingInstructions (List< Type > filterTypes)
 
Target GetTargetDataForTarget (Target target, bool noSqrt)
 Uses given targets position to calculate targeting data from this systems point of view for single target. Use case: You can have 1 system that calculates a target list and from that take 1 target and recalculate from another point of view This is used in a turret example project, where 1 system provides closest target to multiple turrets that recalculate targeting data for that taget to see, if the turret is looking close enough to a target to be considered a lock on to target. another way would be to get closest target from both systems, but this would be highly inefficient for many turrets. More...
 
void MoveClosestTargetToPosition (Vector3 newPosition, float speedMultiplier, float distanceToStop)
 Moves closest target with give instructions More...
 
void MoveClosestTargetToPosition (Vector3 newPosition)
 Moves closest target with give instructions
 
IEnumerator DestroyTargetAfter (Target target, float time)
 Function that can be used to destroy game object or entity target. More...
 
void DestroyTarget (Target target)
 Function that can be used to destroy game object or entity target.
 
IEnumerator DestroyTargetAtDistance (Target target, float distanceToDestroyAt, float timeOut)
 Function that can be used to destroy game object or entity target at given distance from targeting system More...
 
IEnumerator DestroyTargetAtDistanceToObject (Target target, Transform transform, float distanceToDestroyAt)
 Function that can be used to destroy game object or entity target at given distance from targeting system More...
 
void TriggerTargetingActions (Target target)
 Spawn prefabs from actions template object.
 
GeometryDataModels.GeoInfo GetGeoInfoBasedOnHashCode (int geoInfoHashCode)
 Fetch the data structure for gameObject based on the hash code usually got from the target object. Target object cannot contain transforms or gameObjects, because its not safe. More...
 
Transform GetTransformBasedOnGeoHashCode (int4 geoInfoHashCode)
 Gets you a transform of a target object based on the hashCode inside it. More...
 
GameObject GetGameObjectBasedOnGeoHashCode (int4 geoInfoHashCode)
 Gets you a gameObject of a target object based on the hashCode inside it. More...
 
GetVisibilityProcessor< T > ()
 Used to get the eye implementation for either game object or entities from hash set. More...
 
int GetClosestTargetCount ()
 
void SetDefaultEntityFilter (Type typeToSet)
 Sets the default entity filter type for the first targeting instruction (TargetingInstructions[0]) More...
 
int GetCullingModeAsInt ()
 
JobHandle AddSpaceToTargetsContainerJob (NativeSlice< Target > geometryVisionEntityTargetsSlice, JobHandle jobHandle)
 
void SetGameObjectBasedProcessingOnOrOff (bool on)
 

Properties

float TargetingDistance = 1500f [get, set]
 
bool UpdateLocator [get]
 
Target ClosestTarget [get, set]
 
Target MostDistantTarget [get, set]
 
bool ClosestTargetFetchedForCurrentFrame = false [get, set]
 
bool MostDistantTargetFetchedForCurrentFrame = false [get, set]
 
bool UseBounds [get, set]
 
Transform TargetingIndicatorObject [get, set]
 Targeting locator or indicator GameObject made to visualise the closest target, if wanted. More...
 
int TargetContainerCapacity [get]
 
int4 TargetingSystemIndex [get, set]
 
GeometryDataModels.CullingBehaviour CullingBehaviour [get, set]
 
int TargetingSystemGroupIndex [get, set]
 
Vector3 targetingSystemDirection [get]
 
float FieldOfView [get, set]
 
List< TargetingInstructionTargetingInstructions [get]
 
Plane[] Planes [get, set]
 
Camera HiddenUnityCamera [get, set]
 
TargetingDebugInstruction TargetingDebugOptions [get, set]
 
BoolReactiveProperty EntityBasedProcessing [get]
 
BoolReactiveProperty GameObjectBasedProcessing [get]
 
HashSet< ITargetVisibilityProcessorTargetVisibilityProcessors [get]
 
TargetingSystemsRunner Runner [get, set]
 Link to runner that is shared across all targeting systems
 
NativeList< TargetClosestTargetsContainer [get, set]
 
int AmountOfTargets [get, set]
 
float IndicatorVisibilityDistance [get, set]
 
bool NativeMemoryInitialized [get, set]
 

Detailed Description

Class that shows up as a targeting system controller for the user. Main class for using the targeting system plugin.

Usage: Add to objects you want to act as a targeting system. The component will handle the rest. A lot of the settings are meant to be adjusted from the inspector UI. Do not add this to camera object since it creates its own camera and hides it from the user. Create empty gameobject instead and add that as a child object to the camera.

Member Function Documentation

◆ DestroyTargetAfter()

IEnumerator Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.DestroyTargetAfter ( Target  target,
float  time 
)

Function that can be used to destroy game object or entity target.

Parameters
targetTarget wanted to be destroyed
timeTime after target is destroyed

◆ DestroyTargetAtDistance()

IEnumerator Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.DestroyTargetAtDistance ( Target  target,
float  distanceToDestroyAt,
float  timeOut 
)

Function that can be used to destroy game object or entity target at given distance from targeting system

Parameters
targetTarget to destroy
distanceToDestroyAtDistance from target to targetingSystem component, if closer then the target gets destroyed
Returns

◆ DestroyTargetAtDistanceToObject()

IEnumerator Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.DestroyTargetAtDistanceToObject ( Target  target,
Transform  transform,
float  distanceToDestroyAt 
)

Function that can be used to destroy game object or entity target at given distance from targeting system

Parameters
targetTarget to destroy
distanceToDestroyAtDistance from target to targetingSystem component, if closer then the target gets destroyed
Returns

◆ GetClosestTarget()

Target Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetClosestTarget ( bool  forceUpdate)

Gets closest entity or gameObject as target according to parameters set by the user from GV_TargetingSystem component.

Normally update is done every frame so calling this with forceUpdate set to true will impact performance when using multiple systems. Usecase where this might be needed, is when something is destroyed on the main thread and the new target search is required immediately for next function or when measuring performance

Parameters
forceUpdateSchedules a job to instantly update targets.
Returns
GeometryDataModels.Target that contain information about gameObject or entity

◆ GetClosestTargetAsGameObject()

GameObject Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetClosestTargetAsGameObject ( bool  forceUpdate)

Gets closest gameObject, if none return null.

Parameters
forceUpdateSchedules a job to instantly update targets.
Returns
GeometryDataModels.Target that contain information about gameObject or entity

◆ GetClosestTargets() [1/2]

NativeSlice< Target > Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetClosestTargets ( bool  forceUpdate)

Gets targets for both entities and GameObject. Then sorts them.

Normally update is done every frame so manually calling this at the middle of frame with forceUpdate = true might impact performance. Case where this might be needed is when something is destroyed on the main thread and the new target search is required immediately for next function or when measuring performance

Parameters
forceUpdateSchedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop
Returns
New list of sorted targets

◆ GetClosestTargets() [2/2]

NativeSlice< Target > Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetClosestTargets ( bool  forceUpdate,
bool  coldStart 
)

Gets targets for both entities and GameObject. Then sorts them.

Normally update is done every frame so manually calling this at the middle of frame with forceUpdate = true might impact performance. Case where this might be needed is when something is destroyed on the main thread and the new target search is required immediately for next function or when measuring performance

Parameters
forceUpdateSchedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop
coldStartAlso initialize System. This enables the system to work before Start() is called.
Returns
New list of sorted targets

◆ GetGameObjectBasedOnGeoHashCode()

GameObject Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetGameObjectBasedOnGeoHashCode ( int4  geoInfoHashCode)

Gets you a gameObject of a target object based on the hashCode inside it.

Parameters
geoInfoHashCodeThe hashcode from target struct. Target.geoInfoHashCode
Returns
related gameObjects transform

◆ GetGeoInfoBasedOnHashCode()

GeometryDataModels.GeoInfo Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetGeoInfoBasedOnHashCode ( int  geoInfoHashCode)

Fetch the data structure for gameObject based on the hash code usually got from the target object. Target object cannot contain transforms or gameObjects, because its not safe.

Parameters
geoInfoHashCodeHash code that you can get from closest target
Returns
geoInfo object that contains reference to gameObject related data

◆ GetMostDistantTarget()

Target Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetMostDistantTarget ( bool  forceUpdate)

Gets closest entity or gameObject as target according to parameters set by the user from GV_TargetingSystem component. If there is no targets it tries to first update the closest target list.

Normally update is done every frame so manually calling this at the middle of frame might impact performance. Usecase where this might be needed, is when something is destroyed on the main thread and the new target search is required immediately for next function or when measuring performance

Parameters
forceUpdateSchedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop
Returns
GeometryDataModels.Target that contain information about gameObject or entity

◆ GetTargetDataForTarget()

Target Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetTargetDataForTarget ( Target  target,
bool  noSqrt 
)

Uses given targets position to calculate targeting data from this systems point of view for single target. Use case: You can have 1 system that calculates a target list and from that take 1 target and recalculate from another point of view This is used in a turret example project, where 1 system provides closest target to multiple turrets that recalculate targeting data for that taget to see, if the turret is looking close enough to a target to be considered a lock on to target. another way would be to get closest target from both systems, but this would be highly inefficient for many turrets.

Parameters
targettarget to get data for
Returns
target containing the the calculated data

◆ GetTransformBasedOnGeoHashCode()

Transform Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetTransformBasedOnGeoHashCode ( int4  geoInfoHashCode)

Gets you a transform of a target object based on the hashCode inside it.

Parameters
geoInfoHashCodeThe hashcode from target struct. Target.geoInfoHashCode
Returns
related gameObjects transform

◆ GetVisibilityProcessor< T >()

T Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetVisibilityProcessor< T > ( )

Used to get the eye implementation for either game object or entities from hash set.

Template Parameters
TImplementation to get. If none exists return default T
Returns

◆ MoveClosestTargetToPosition()

void Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.MoveClosestTargetToPosition ( Vector3  newPosition,
float  speedMultiplier,
float  distanceToStop 
)

Moves closest target with give instructions

Parameters
newPositionPosition to move
speedMultiplierGives extra speed
distanceToStop0 value means it will travel to target. 1 value means it will stop 1 unit before reaching destination. If distance to stop is larger than distance to travel the target will not move.

◆ SetDefaultEntityFilter()

void Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.SetDefaultEntityFilter ( Type  typeToSet)

Sets the default entity filter type for the first targeting instruction (TargetingInstructions[0])

Parameters
typeToSetType to be used in targeting search query

Property Documentation

◆ TargetingIndicatorObject

Transform Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.TargetingIndicatorObject
getset

Targeting locator or indicator GameObject made to visualise the closest target, if wanted.

Setter that also checks, if gameObject is in the scene and then spawns, if not.


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