public void ShowMino(Mino mino) { List <Vector2Int> l = Field.GetAllCoordinates(mino); foreach (Vector2Int v in l) { DisplayUtils.InstChild(MinoTiles[mino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), MinoParent); } }
private void UpdateHoldDisplay() { int holdid = game.GetHoldId(); DestroyAllChild(HoldArea); if (holdid != 0) { DisplayUtils.InstChild(Minoes[holdid - 1], Vector3Int.zero, HoldArea); } }
public void ShowMino(int minoID, int x, int y, int rotation) { Mino mino = new Mino(minoID, x, y, rotation); List <Vector2Int> l = Field.GetAllCoordinates(mino); foreach (Vector2Int v in l) { DisplayUtils.InstChild(MinoTiles[mino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), MinoParent); } }
private void UpdateActiveMinoDisplay() { DestroyAllChild(ActiveMinoParent); Mino tmpMino = game.GetActiveMino(); //方块 List <Vector2Int> l = Field.GetAllCoordinates(game.activeMino); int ghostDist = tmpMino.GetPosition().y - game.GetGhostY(); foreach (Vector2Int v in l) { DisplayUtils.InstChild(MinoTiles[tmpMino.GetIdInt() - 1], new Vector3(v.x, v.y, 0), ActiveMinoParent); if (game.Playing()) { DisplayUtils.InstChild(MinoTiles[tmpMino.GetIdInt() - 1], new Vector3(v.x, v.y - ghostDist, 0), ActiveMinoParent, 1, 0.5f); } } }
public void UpdateFieldDisplay() { DestroyAllChild(ParentField); int[,] field = game.GetFieldArray(); //InstChild(Minoes[activeMinoId-1], tmp, ParentField,1,0.6f); //场地 for (int x = 0; x < 10; x++) { for (int y = 0; y < 20; y++) { if (1 <= field[x, y] && field[x, y] <= 7) { DisplayUtils.InstChild(MinoTiles[field[x, y] - 1], new Vector3(x, y, 0), ParentField); } } } }
private void UpdateNextDisplay() { DestroyAllChild(NextArea); int[] nextSeq = game.GetNextSeq(); for (int i = 0; i < MAX_NEXT; i++) { int id = nextSeq[i]; Vector3 offset = Vector3.zero; if (id == Mino.NameToId("J")) { offset.x = -0.5f; } else if (id == Mino.NameToId("I")) { offset.x = 0.5f; } else if (id == Mino.NameToId("O")) { offset.y = 0.5f; } DisplayUtils.InstChild(Minoes[nextSeq[i] - 1], new Vector3(0, -2.5f * i, 0) + offset, NextArea, 0.8f); } }