public virtual void AddColliderSegments(Shadow2DLight shadow2DLight, List<Segment> segments, Collider2D collider) { _shadow2DLight = shadow2DLight; BoxCollider2D boxCollider2D = collider as BoxCollider2D; if (boxCollider2D != null) { AddBoxCollider2DSegments(segments, boxCollider2D); return; } CircleCollider2D circleCollider2D = collider as CircleCollider2D; if (circleCollider2D != null) { AddCircleCollider2DSegments(segments, circleCollider2D); return; } PolygonCollider2D polygonCollider2D = collider as PolygonCollider2D; if (polygonCollider2D != null) { AddPolygonCollider2DSegments(segments, polygonCollider2D); return; } EdgeCollider2D edgeCollider2D = collider as EdgeCollider2D; if (edgeCollider2D != null) { AddEdgeCollider2DSegments(segments, edgeCollider2D); return; } //Debug.LogFormat("Unhandled collider: {0}", collider); }
public virtual void AddColliderSegments(Shadow2DLight shadow2DLight, List <Segment> segments, Collider2D collider) { _shadow2DLight = shadow2DLight; BoxCollider2D boxCollider2D = collider as BoxCollider2D; if (boxCollider2D != null) { AddBoxCollider2DSegments(segments, boxCollider2D); return; } CircleCollider2D circleCollider2D = collider as CircleCollider2D; if (circleCollider2D != null) { AddCircleCollider2DSegments(segments, circleCollider2D); return; } PolygonCollider2D polygonCollider2D = collider as PolygonCollider2D; if (polygonCollider2D != null) { AddPolygonCollider2DSegments(segments, polygonCollider2D); return; } EdgeCollider2D edgeCollider2D = collider as EdgeCollider2D; if (edgeCollider2D != null) { AddEdgeCollider2DSegments(segments, edgeCollider2D); return; } //Debug.LogFormat("Unhandled collider: {0}", collider); }
public void Clear(Shadow2DLight shadow2DLight) { Segments.Clear(); EndPoints.Clear(); Open.Clear(); Output.Clear(); Center = shadow2DLight.transform.position; Size = shadow2DLight.size; Color = shadow2DLight.color; MergeCollinearSegments = shadow2DLight.mergeCollinearShadowSegments; float top = Size / 2f; float btm = -Size / 2f; float left = -Size / 2f; float right = Size / 2f; TopLeft = shadow2DLight.transform.TransformPoint(new Vector3(left, top, 0f)); BottomLeft = shadow2DLight.transform.TransformPoint(new Vector3(left, btm, 0f)); BottomRight = shadow2DLight.transform.TransformPoint(new Vector3(right, btm, 0f)); _drawGizmos = shadow2DLight._drawGizmos; _clipping = shadow2DLight.clipping; }