public static void Swap(Matchable first, Matchable second) { int firstType = first.type; first.type = second.type; second.type = firstType; }
public bool IsNeighbor(Matchable candidate) { return(candidate == top || candidate == bottom || candidate == left || candidate == right || candidate == front || candidate == back); }
public static bool MatchingSwap(Matchable first, Matchable second) { Swap(first, second); if (first.AnyMatch() || second.AnyMatch()) { Swap(first, second); return(true); } else { Swap(first, second); return(false); } }
void CreateGrid() { grid = new Matchable[width, height, depth]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < depth; z++) { grid[x, y, z] = Instantiate( prefab, new Vector3(x - ((float)width - 1) / 2, y - ((float)height - 1) / 2, z - ((float)depth - 1) / 2), Quaternion.identity, transform); } } } }
public SwapPair(Matchable first, Matchable second) { this.first = first; this.second = second; }