Example #1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (previous_state == 1)
     {
         if (game_logic.SwapTile(this))
         {
             state = 0;
         }
     }
     else if (previous_state == 2)
     {
         if (game_logic.CheckSelectedForm(this, index_tile, color, true))
         {
         }
     }
     if (previous_state != 1 && eventData.button == PointerEventData.InputButton.Left)
     {
         state = 1;
         if (game_logic.SwapTile(this))
         {
             state = 0;
         }
     }
     if (previous_state != 2 && eventData.button == PointerEventData.InputButton.Right && color != 4)
     {
         state = 2;
         if (game_logic.CheckSelectedForm(this, index_tile, color, false))
         {
             state = 0;
         }
     }
     if (state == previous_state)
     {
         state = 0;
     }
     previous_state = state;
     SwitchSprite(select_sprite [state]);
     // OnClick code goes here ...
 }