private void TraceMergeToEnd(Outline target, Outline sacrifice) { if (target == sacrifice) { return; } target.AddLast(sacrifice); tracerTotal.Remove(sacrifice); foreach (int key in tracerProc.Keys.ToArray()) // It fears manipulation { if (tracerProc[key] == sacrifice) { tracerProc[key] = target; } } }
private void Start() { LivesText.text = $"Lives: {Lives}"; int verticesColCount = _vertices.GetLength(0); int verticesRowCount = _vertices.GetLength(1); for (int i = 0; i < verticesColCount; i++) { for (int j = 0; j < verticesRowCount; j++) { _vertices[i, j] = new Vertex(this, i, j); } } for (int i = 0; i < CellColCount; i++) { for (int j = 0; j < CellRowCount; j++) { _cells[i, j] = new Cell(this, i, j, _vertices[i, j], _vertices[i + 1, j], _vertices[i, j + 1], _vertices[i + 1, j + 1]); Tile cellTile = (i % 2 != j % 2 ? Cell1 : Cell2); BackgroundTileMap.SetTile(new Vector3Int(i, j, 0), cellTile); } } Line line = GetLine(); line.AddPoint(new Vector3(0, 0)); line.AddPoint(new Vector3(verticesColCount - 1, 0)); line.AddPoint(new Vector3(verticesColCount - 1, verticesRowCount - 1)); line.AddPoint(new Vector3(0, verticesRowCount - 1)); line.AddPoint(new Vector3(0, 0)); line.PlaceLine(); Outline.Clear(); for (int i = 0; i < verticesColCount - 1; i++) { Vertex vertex = _vertices[i, 0]; vertex.IsLinked = true; Outline.AddLast(vertex); } for (int j = 0; j < verticesRowCount - 1; j++) { Vertex vertex = _vertices[verticesColCount - 1, j]; vertex.IsLinked = true; Outline.AddLast(vertex); } for (int i = verticesColCount - 1; i > 0; i--) { Vertex vertex = _vertices[i, verticesRowCount - 1]; vertex.IsLinked = true; Outline.AddLast(vertex); } for (int j = verticesRowCount - 1; j > 0; j--) { Vertex vertex = _vertices[0, j]; vertex.IsLinked = true; Outline.AddLast(vertex); } SpawnPlayer(); SpawnEnemies(); }