Targeting System 2.0.0
Plugin for multipurpose targeting and visual effects.
|
Class that shows up as a targeting system controller for the user. Main class for using the targeting system plugin. More...
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< Target > | GetClosestTargets (bool forceUpdate) |
Gets targets for both entities and GameObject. Then sorts them. More... | |
NativeSlice< Target > | GetClosestTargets (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... | |
T | 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< TargetingInstruction > | TargetingInstructions [get] |
Plane[] | Planes [get, set] |
Camera | HiddenUnityCamera [get, set] |
TargetingDebugInstruction | TargetingDebugOptions [get, set] |
BoolReactiveProperty | EntityBasedProcessing [get] |
BoolReactiveProperty | GameObjectBasedProcessing [get] |
HashSet< ITargetVisibilityProcessor > | TargetVisibilityProcessors [get] |
TargetingSystemsRunner | Runner [get, set] |
Link to runner that is shared across all targeting systems | |
NativeList< Target > | ClosestTargetsContainer [get, set] |
int | AmountOfTargets [get, set] |
float | IndicatorVisibilityDistance [get, set] |
bool | NativeMemoryInitialized [get, set] |
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.
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.
target | Target wanted to be destroyed |
time | Time after target is destroyed |
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
target | Target to destroy |
distanceToDestroyAt | Distance from target to targetingSystem component, if closer then the target gets destroyed |
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
target | Target to destroy |
distanceToDestroyAt | Distance from target to targetingSystem component, if closer then the target gets destroyed |
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
forceUpdate | Schedules a job to instantly update targets. |
GameObject Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.GetClosestTargetAsGameObject | ( | bool | forceUpdate | ) |
Gets closest gameObject, if none return null.
forceUpdate | Schedules a job to instantly update targets. |
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
forceUpdate | Schedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop |
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
forceUpdate | Schedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop |
coldStart | Also initialize System. This enables the system to work before Start() is called. |
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.
geoInfoHashCode | The hashcode from target struct. Target.geoInfoHashCode |
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.
geoInfoHashCode | Hash code that you can get from closest target |
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
forceUpdate | Schedules a job to instantly update targets instead of using chunkKeysForTargeting from the update loop |
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.
target | target to get data for |
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.
geoInfoHashCode | The hashcode from target struct. Target.geoInfoHashCode |
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.
T | Implementation to get. If none exists return default T |
void Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.MoveClosestTargetToPosition | ( | Vector3 | newPosition, |
float | speedMultiplier, | ||
float | distanceToStop | ||
) |
Moves closest target with give instructions
newPosition | Position to move |
speedMultiplier | Gives extra speed |
distanceToStop | 0 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. |
void Plugins.GeometricVision.TargetingSystem.Code.MainClass.GV_TargetingSystem.SetDefaultEntityFilter | ( | Type | typeToSet | ) |
Sets the default entity filter type for the first targeting instruction (TargetingInstructions[0])
typeToSet | Type to be used in targeting search query |
|
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.