public static int tdcShowTexture(Tdc tdc) { int[] coords = tdcGridCoordinates(tdc); if (coords[0] == -1 || coords[1] == -1) return 0; if ((tdcTextureIndices[coords[0], coords[1]] == 0) && (tdcRolledIndices[coords[0], coords[1]] > 0)) { tdcTextureIndices[coords[0], coords[1]] = 1; Grid.resetTdcsButton.GetComponent<SpriteRenderer>().sprite = Grid.resetTdcsButton.textures[1]; } return tdcTextureIndices[coords[0], coords[1]]; }
public static int tdcFlippedTexture(Tdc tdc) { int[] coords = tdcGridCoordinates(tdc); if (coords[0] == -1 || coords[1] == -1) return 0; if (tdcRolledIndices[coords[0], coords[1]] > 0) { Grid.resetTdcsButton.GetComponent<SpriteRenderer>().sprite = Grid.resetTdcsButton.textures[1]; if (tdcTextureIndices[coords[0], coords[1]] == 0) tdcTextureIndices[coords[0], coords[1]] = 1; else if (tdcTextureIndices[coords[0], coords[1]] == 1) tdcTextureIndices[coords[0], coords[1]] = tdcRolledIndices[coords[0], coords[1]]; else if (tdcTextureIndices[coords[0], coords[1]] > 0) tdcTextureIndices[coords[0], coords[1]] = 1; return tdcTextureIndices[coords[0], coords[1]]; } else return 0; }
public static int[] tdcGridCoordinates(Tdc tdc) { int[] coords = new int[2]; coords[0] = -1; coords[1] = -1; for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { if (tdc == tdcs[i, j]) { coords[0] = i; coords[1] = j; } } } return coords; }
public static int tdcCurrentTexture(Tdc tdc) { int[] coords = tdcGridCoordinates(tdc); if (coords[0] == -1 || coords[1] == -1) return 0; return tdcTextureIndices[coords[0], coords[1]]; }