예제 #1
0
        public static void Swap(Matchable first, Matchable second)
        {
            int firstType = first.type;

            first.type  = second.type;
            second.type = firstType;
        }
예제 #2
0
 public bool IsNeighbor(Matchable candidate)
 {
     return(candidate == top ||
            candidate == bottom ||
            candidate == left ||
            candidate == right ||
            candidate == front ||
            candidate == back);
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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);
             }
         }
     }
 }
예제 #5
0
 public SwapPair(Matchable first, Matchable second)
 {
     this.first  = first;
     this.second = second;
 }