Class CollisionCounter
Monitors and tracks collisions with 2D colliders.
Implements
Namespace: WeaverCore.Components
Assembly: WeaverCore.dll
Syntax
public class CollisionCounter : MonoBehaviour, IOnPool
Properties
| Edit this page View SourceCollidedObjectCount
Gets the count of currently collided objects.
Declaration
public int CollidedObjectCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
CollidedObjects
Gets the collection of colliders that the object has collided with.
Declaration
public IEnumerable<Collider2D> CollidedObjects { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Collider2D> |
Methods
| Edit this page View SourceGetNearestTarget(Vector3)
Finds the nearest target collider based on the given source position.
Declaration
public Collider2D GetNearestTarget(Vector3 sourcePos)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | sourcePos | The source position from which to find the nearest target. |
Returns
| Type | Description |
|---|---|
| Collider2D | The nearest target collider or null if none found. |
OnPool()
Clears the list of collided objects when the object is pooled.
Declaration
public void OnPool()