Exemplo n.º 1
0
 public void OnMouseDown()
 {
     if (elementController.canPlay && !hasGoalPosition)
     {
         if (selectedElement == null)
         {
             SelectElement(this);
         }
         else
         {
             if (selectedElement == this)
             {
                 SelectElement(null);
             }
             else
             {
                 if (Mathf.Abs(selectedElement.fieldPosition.x - fieldPosition.x) + Mathf.Abs(selectedElement.fieldPosition.y - fieldPosition.y) == 1)
                 {
                     ElementController.GetInstance().Swap(this, selectedElement, true);
                     SelectElement(null);
                 }
                 else
                 {
                     SelectElement(this);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public Game()
 {
     elementController      = ElementController.GetInstance();
     elementController.game = this;
 }