Ejemplo n.º 1
0
        public static void Swap(Matchable first, Matchable second)
        {
            int firstType = first.type;

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