private void RebuildCell(D2dEdgeColliderCell cell, int x, int y) { var xMin = CellSize * x; var yMin = CellSize * y; var xMax = Mathf.Min(CellSize + xMin, destructible.AlphaWidth); var yMax = Mathf.Min(CellSize + yMin, destructible.AlphaHeight); D2dColliderBuilder.CalculateEdge(destructible.AlphaData, destructible.AlphaWidth, destructible.AlphaHeight, xMin, xMax, yMin, yMax); D2dColliderBuilder.BuildEdge(cell, unusedColliders, child, Detail); cell.UpdateColliderSettings(IsTrigger, Material); }
private void RebuildCell(ref D2dEdgeColliderCell cell, int cellX, int cellY) { var xMin = CellSize * cellX; var yMin = CellSize * cellY; var xMax = Mathf.Min(CellSize + xMin, destructible.AlphaWidth); var yMax = Mathf.Min(CellSize + yMin, destructible.AlphaHeight); if (xMin > 0) { xMin += 1; } if (yMin > 0) { yMin += 1; } if (xMax < destructible.AlphaWidth) { xMax -= 1; } if (yMax < destructible.AlphaHeight) { yMax -= 1; } D2dColliderBuilder.AlphaData = destructible.AlphaData; D2dColliderBuilder.AlphaWidth = destructible.AlphaWidth; D2dColliderBuilder.AlphaHeight = destructible.AlphaHeight; D2dColliderBuilder.MinX = xMin; D2dColliderBuilder.MinY = yMin; D2dColliderBuilder.MaxX = xMax; D2dColliderBuilder.MaxY = yMax; D2dColliderBuilder.CalculateEdgeCells(); if (cell == null) { cell = D2dEdgeColliderCell.Get(); } cell.Clear(tempColliders); D2dColliderBuilder.BuildEdge(cell, tempColliders, child, Weld, Detail); cell.UpdateColliderSettings(IsTrigger, Material); }
public static void BuildEdge(D2dEdgeColliderCell cell, Stack <EdgeCollider2D> tempColliders, GameObject child, float weld, float detail) { // Find the start points of paths for (var i = 0; i < pointCount; i++) { var point = points[i]; // Build path from point if (point.Used == false) { Trace(point); WeldLines(weld); OptimizeEdges(detail); cell.AddPath(tempColliders, child, ExtractPoints(0)); } } }
private void Mark() { tempColliders.Clear(); if (cells != null) { for (var i = cells.Length - 1; i >= 0; i--) { var cell = cells[i]; if (cell != null) { cell.Clear(tempColliders); cells[i] = D2dEdgeColliderCell.Add(cell); } } } }
public static void BuildEdge(D2dEdgeColliderCell cell, List <EdgeCollider2D> unusedColliders, GameObject child, float detail) { cell.Clear(unusedColliders); // Find the start points of paths for (var i = 0; i < pointCount; i++) { var point = points[i]; if (point.Used == false) { Trace(point); WeldLines(); OptimizeEdges(detail); cell.AddPath(unusedColliders, child, ExtractPoints(0)); } } }
private void Mark(D2dEdgeColliderCell cell) { cell.Clear(unusedColliders); }
public static D2dEdgeColliderCell Add(D2dEdgeColliderCell cell) { pool.Push(cell); return(null); }