void Update() { switch (Cast) { case CastType.OverlapCircle: if (CastAll) { RBPhysics2D.OverlapCircleAll(transform.position, Radius, castLayers.value); } else { RBPhysics2D.OverlapCircle(transform.position, Radius, castLayers.value); } break; case CastType.OverlapArea: Vector2 cornerA = (Vector2)transform.position + CornerAOffset; Vector2 cornerB = (Vector2)transform.position + CornerBOffset; if (CastAll) { RBPhysics2D.OverlapAreaAll(cornerA, cornerB, castLayers.value); } else { RBPhysics2D.OverlapArea(cornerA, cornerB, castLayers.value); } break; } }
void Update() { switch (Method) { case CastMethod.Single: RBPhysics2D.CircleCast(transform.position, Radius, transform.up, Distance, castLayers); break; case CastMethod.CastAll: RBPhysics2D.CircleCastAll(transform.position, Radius, transform.up, Distance, castLayers); break; case CastMethod.NonAlloc: RBPhysics2D.CircleCastNonAlloc(transform.position, Radius, transform.up, results, Distance, castLayers); break; } }
void Update() { Vector3 start = transform.position; Vector3 direction = transform.up; if (Cast == CastType.Linecast) { Vector3 end = start + (Distance * direction); switch (Method) { case CastMethod.Single: RBPhysics2D.LineCast(start, end, castLayers); break; case CastMethod.All: RBPhysics2D.LineCastAll(start, end, castLayers); break; case CastMethod.NonAlloc: RBPhysics2D.LineCastNonAlloc(start, end, results, castLayers); break; } } else { switch (Method) { case CastMethod.Single: RBPhysics2D.RayCast(start, direction, Distance, castLayers); break; case CastMethod.All: RBPhysics2D.RayCastAll(start, direction, Distance, castLayers); break; case CastMethod.NonAlloc: RBPhysics2D.RayCastNonAlloc(start, direction, results, Distance, castLayers); break; } } }