Class LevelObjectUtility
Helper functions for level objects.
public static class LevelObjectUtility
- Inheritance
-
LevelObjectUtility
- Inherited Members
Methods
CountObjects(IAssetLink<ObjectAsset>, int)
Count the number of objects in the given radius matching an asset.
[Pure]
public static int CountObjects(IAssetLink<ObjectAsset> asset, int max = -1)
Parameters
assetIAssetLink<ObjectAsset>maxint
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
CountObjectsInRange(Vector3, float, int, bool)
Count the number of objects in the given radius.
[Pure]
public static int CountObjectsInRange(Vector3 position, float radius, int max = -1, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- GameThreadException
Not on main thread.
CountObjectsInRange(Vector3, float, IAssetLink<ObjectAsset>, int, bool)
Count the number of objects in the given radius matching an asset.
[Pure]
public static int CountObjectsInRange(Vector3 position, float radius, IAssetLink<ObjectAsset> asset, int max = -1, bool horizontalDistanceOnly = false)
Parameters
positionVector3radiusfloatassetIAssetLink<ObjectAsset>maxinthorizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
CountObjectsWhere(Predicate<LevelObject>, int)
Count the number of objects in the given radius matching a predicate.
[Pure]
public static int CountObjectsWhere(Predicate<LevelObject> objectSelector, int max = -1)
Parameters
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
CountObjectsWhere(Vector3, float, Predicate<LevelObject>, int, bool)
Count the number of objects in the given radius matching a predicate.
[Pure]
public static int CountObjectsWhere(Vector3 position, float radius, Predicate<LevelObject> objectSelector, int max = -1, bool horizontalDistanceOnly = false)
Parameters
positionVector3radiusfloatobjectSelectorPredicate<LevelObject>maxinthorizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
EnumerateObjects()
Enumerate through all level objects around the center of the level.
[Pure]
public static ObjectIterator EnumerateObjects()
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(RegionCoord)
Enumerate through all level objects around the given region.
[Pure]
public static ObjectIterator EnumerateObjects(RegionCoord region)
Parameters
regionRegionCoord
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(RegionCoord, byte)
Enumerate through all level objects around the given region.
[Pure]
public static ObjectIterator EnumerateObjects(RegionCoord region, byte maxRegionDistance)
Parameters
regionRegionCoordmaxRegionDistancebyte
Returns
Remarks
The square enumerated will have a size of regions.maxRegionDistance * 2 + 1
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(byte, byte)
Enumerate through all level objects around the region x, y.
[Pure]
public static ObjectIterator EnumerateObjects(byte x, byte y)
Parameters
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(byte, byte, byte)
Enumerate through all level objects around the region x, y.
[Pure]
public static ObjectIterator EnumerateObjects(byte x, byte y, byte maxRegionDistance)
Parameters
Returns
Remarks
The square enumerated will have a size of regions.maxRegionDistance * 2 + 1
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(Vector3)
Enumerate through all level objects around the center of the level.
[Pure]
public static ObjectIterator EnumerateObjects(Vector3 center)
Parameters
centerVector3
Returns
Exceptions
- GameThreadException
Not on main thread.
EnumerateObjects(Vector3, byte)
Enumerate through all level objects around the center of the level.
[Pure]
public static ObjectIterator EnumerateObjects(Vector3 center, byte maxRegionDistance)
Parameters
centerVector3maxRegionDistancebyte
Returns
Remarks
The square enumerated will have a size of regions.maxRegionDistance * 2 + 1
Exceptions
- GameThreadException
Not on main thread.
FindObject(uint)
Find a object by it's instance ID.
[Pure]
public static ObjectInfo FindObject(uint instanceId)
Parameters
instanceIduint
Returns
Exceptions
- GameThreadException
Not on main thread.
FindObject(uint, byte, byte)
Find a object by it's instance ID, with help from an expected region to prevent having to search every region.
[Pure]
public static ObjectInfo FindObject(uint instanceId, byte expectedRegionX, byte expectedRegionY)
Parameters
Returns
Remarks
All regions will be searched if it's not found in the expected region.
Exceptions
- GameThreadException
Not on main thread.
FindObject(uint, IAssetLink<ObjectAsset>, Vector3)
Find a object by it's instance ID, with help from an expected region to prevent having to search every region.
[Pure]
public static ObjectInfo FindObject(uint instanceId, IAssetLink<ObjectAsset> expectedAsset, Vector3 expectedPosition)
Parameters
instanceIduintexpectedAssetIAssetLink<ObjectAsset>expectedPositionVector3
Returns
Remarks
All regions will be searched if it's not found in the expected region.
Exceptions
- GameThreadException
Not on main thread.
FindObject(uint, Vector3)
Find a object by it's instance ID, with help from a position to prevent having to search every region.
[Pure]
public static ObjectInfo FindObject(uint instanceId, Vector3 expectedPosition)
Parameters
instanceIduintexpectedPositionVector3
Returns
Remarks
All regions will be searched if it's not found near the expected position.
Exceptions
- GameThreadException
Not on main thread.
FindObject(Transform)
Find a object by it's Unity UnityEngine.Transform.
[Pure]
public static ObjectInfo FindObject(Transform transform)
Parameters
transformTransform
Returns
Exceptions
- GameThreadException
Not on main thread.
GetClosestObject(Vector3, bool)
Find the closest object to position.
[Pure]
public static ObjectInfo GetClosestObject(Vector3 position, bool horizontalDistanceOnly = false)
Parameters
positionVector3horizontalDistanceOnlybool
Returns
Exceptions
- GameThreadException
Not on main thread.
GetClosestObject(Vector3, IAssetLink<ObjectAsset>, bool)
Find the closest object with the given asset to position.
[Pure]
public static ObjectInfo GetClosestObject(Vector3 position, IAssetLink<ObjectAsset> asset, bool horizontalDistanceOnly = false)
Parameters
positionVector3assetIAssetLink<ObjectAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetClosestObjectInRange(Vector3, float, bool)
Find the closest object to position within the given radius.
[Pure]
public static ObjectInfo GetClosestObjectInRange(Vector3 position, float radius, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- GameThreadException
Not on main thread.
GetClosestObjectInRange(Vector3, float, IAssetLink<ObjectAsset>, bool)
Find the closest object with the given asset to position within the given radius.
[Pure]
public static ObjectInfo GetClosestObjectInRange(Vector3 position, float radius, IAssetLink<ObjectAsset> asset, bool horizontalDistanceOnly = false)
Parameters
positionVector3radiusfloatassetIAssetLink<ObjectAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetClosestObjectWhere(Vector3, Predicate<LevelObject>, bool)
Find the closest object matching a predicate to position.
[Pure]
public static ObjectInfo GetClosestObjectWhere(Vector3 position, Predicate<LevelObject> objectSelector, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetClosestObjectWhere(Vector3, float, Predicate<LevelObject>, bool)
Find the closest object matching a predicate to position within a given radius.
[Pure]
public static ObjectInfo GetClosestObjectWhere(Vector3 position, float radius, Predicate<LevelObject> objectSelector, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
GetPosition(LevelObject)
Safely get the position of the object in case the main model didn't load.
public static Vector3 GetPosition(LevelObject @object)
Parameters
objectLevelObject
Returns
- Vector3
IsObjectInRange(Vector3, float, bool)
Check for a nearby object to position within the given radius.
[Pure]
public static bool IsObjectInRange(Vector3 position, float radius, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- GameThreadException
Not on main thread.
IsObjectInRange(Vector3, float, Predicate<LevelObject>, bool)
Check for a nearby object matching a predicate to position within the given radius.
[Pure]
public static bool IsObjectInRange(Vector3 position, float radius, Predicate<LevelObject> objectSelector, bool horizontalDistanceOnly = false)
Parameters
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.
IsObjectInRange(Vector3, float, IAssetLink<ObjectAsset>, bool)
Check for a nearby object with the given asset to position within the given radius.
[Pure]
public static bool IsObjectInRange(Vector3 position, float radius, IAssetLink<ObjectAsset> asset, bool horizontalDistanceOnly = false)
Parameters
positionVector3radiusfloatassetIAssetLink<ObjectAsset>horizontalDistanceOnlybool
Returns
Exceptions
- ArgumentNullException
- GameThreadException
Not on main thread.