Class KaijuAgentsNearest3
Extension methods to get the nearest object to a given position along all three axes. Any Vector2 values will be expanded via the Expand(Vector2) method.
Inheritance
Namespace: KaijuSolutions.Agents.Extensions
Syntax
public static class KaijuAgentsNearest3
Methods
Nearest3(Component, IEnumerable<GameObject>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static GameObject Nearest3(this Component position, IEnumerable<GameObject> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Component | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<GameObject> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| GameObject | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Component, IEnumerable<Transform>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Transform Nearest3(this Component position, IEnumerable<Transform> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Component | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Transform> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Transform | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Component, IEnumerable<Vector3>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Vector3 Nearest3(this Component position, IEnumerable<Vector3> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Component | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Vector3> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Vector3 | The nearest instance from the targets to the position. Will be the starting position if the targets list is empty. |
Nearest3(GameObject, IEnumerable<GameObject>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static GameObject Nearest3(this GameObject position, IEnumerable<GameObject> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<GameObject> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| GameObject | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(GameObject, IEnumerable<Transform>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Transform Nearest3(this GameObject position, IEnumerable<Transform> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Transform> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Transform | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(GameObject, IEnumerable<Vector3>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Vector3 Nearest3(this GameObject position, IEnumerable<Vector3> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Vector3> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Vector3 | The nearest instance from the targets to the position. Will be the starting position if the targets list is empty. |
Nearest3(Transform, IEnumerable<GameObject>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static GameObject Nearest3(this Transform position, IEnumerable<GameObject> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<GameObject> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| GameObject | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Transform, IEnumerable<Transform>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Transform Nearest3(this Transform position, IEnumerable<Transform> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Transform> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Transform | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Transform, IEnumerable<Vector3>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Vector3 Nearest3(this Transform position, IEnumerable<Vector3> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Vector3> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Vector3 | The nearest instance from the targets to the position. Will be the starting position if the targets list is empty. |
Nearest3(Vector2, IEnumerable<GameObject>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static GameObject Nearest3(this Vector2 position, IEnumerable<GameObject> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<GameObject> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| GameObject | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Vector2, IEnumerable<Transform>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Transform Nearest3(this Vector2 position, IEnumerable<Transform> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Transform> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Transform | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Vector2, IEnumerable<Vector3>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Vector3 Nearest3(this Vector2 position, IEnumerable<Vector3> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Vector3> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Vector3 | The nearest instance from the targets to the position. Will be the starting position if the targets list is empty. |
Nearest3(Vector3, IEnumerable<GameObject>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static GameObject Nearest3(this Vector3 position, IEnumerable<GameObject> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<GameObject> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| GameObject | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Vector3, IEnumerable<Transform>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Transform Nearest3(this Vector3 position, IEnumerable<Transform> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Transform> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Transform | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Nearest3(Vector3, IEnumerable<Vector3>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static Vector3 Nearest3(this Vector3 position, IEnumerable<Vector3> targets, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<Vector3> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| Vector3 | The nearest instance from the targets to the position. Will be the starting position if the targets list is empty. |
Nearest3<T>(Component, IEnumerable<T>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static T Nearest3<T>(this Component position, IEnumerable<T> targets, out float distance)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| Component | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<T> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| T | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Type Parameters
| Name | Description |
|---|---|
| T |
Nearest3<T>(GameObject, IEnumerable<T>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static T Nearest3<T>(this GameObject position, IEnumerable<T> targets, out float distance)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<T> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| T | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Type Parameters
| Name | Description |
|---|---|
| T |
Nearest3<T>(Transform, IEnumerable<T>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static T Nearest3<T>(this Transform position, IEnumerable<T> targets, out float distance)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<T> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| T | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Type Parameters
| Name | Description |
|---|---|
| T |
Nearest3<T>(Vector2, IEnumerable<T>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static T Nearest3<T>(this Vector2 position, IEnumerable<T> targets, out float distance)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<T> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| T | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Type Parameters
| Name | Description |
|---|---|
| T |
Nearest3<T>(Vector3, IEnumerable<T>, out Single)
The nearest instance across all three axes to a position.
Declaration
public static T Nearest3<T>(this Vector3 position, IEnumerable<T> targets, out float distance)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position to get the nearest target instance to. |
| System.Collections.Generic.IEnumerable<T> | targets | The targets to get the nearest of. |
| System.Single | distance | The distance to the nearest target. |
Returns
| Type | Description |
|---|---|
| T | The nearest instance from the targets to the position. Will be NULL if the targets list is empty. |
Type Parameters
| Name | Description |
|---|---|
| T |