Exemple #1
0
    public void PlayButtonSfx()
    {
#if UNITY_WEBGL
        boardController.Play_sfx(boardController.button_sfx_str);
#else
        boardController.Play_sfx(boardController.button_sfx);
#endif
    }
Exemple #2
0
    public void Big_explosion(int explosion_magnitude)
    {
        string count        = "";
        int    adjust_count = 3;

        if (show_count)
        {
            count = "x" + explosion_magnitude.ToString() + " ";
        }

        if ((explosion_magnitude - adjust_count) > big_explosion_praise.Length)
        {
            my_text.text = count + big_explosion_praise[big_explosion_praise.Length - 1];
        }
        else
        {
            my_text.text = count + big_explosion_praise[explosion_magnitude - adjust_count - 1];
        }


        if (big_explosion_praise_sfx.Length > 0)
        {
            if ((explosion_magnitude - adjust_count) > big_explosion_praise_sfx.Length)
            {
                board.Play_sfx(big_explosion_praise_sfx[big_explosion_praise.Length - 1]);
            }
            else
            {
                board.Play_sfx(big_explosion_praise_sfx[explosion_magnitude - adjust_count - 1]);
            }
        }

        if (!my_canvas.GetComponent <Animation>().isPlaying)
        {
            my_canvas.GetComponent <Animation>().Play("score_anim");
        }
    }
Exemple #3
0
    public void MyOnMouseDown()
    {
        if (board.game_end)
        {
            return;
        }
        //Debug.Log("++++ tile_C.MyOnMouseDown");

        board.touch_number++;
        //if (board.touch_number == 1)
        {
            board.cursor.position = this.transform.position;

            /*
             * Debug.Log( "** 5 = " + board.board_array_master[_x, _y, 5]
             + "** 6 down = " + board.board_array_master[_x, _y, 6]
             + "** 7 up = " + board.board_array_master[_x, _y, 7]
             + "** 8 right = " + board.board_array_master[_x, _y, 8]
             + "** 9 left = " + board.board_array_master[_x, _y, 9]
             +  ); */
            //Debug.Log("state " + board.board_array_master[_x, _y, 11] + " - check? " + board.board_array_master[_x, _y, 13]);

            /*
             * Debug.Log("kind " + board.board_array_master[_x, _y, 1]
             + " useful moves " + board.board_array_master[_x, _y, 5]);
             +
             +
             +          Debug.Log(
             +                  "tile hp " + board.board_array_master[_x,_y,0]
             + "kind " + board.board_array_master[_x,_y,1]
             + "block hp " + board.board_array_master[_x,_y,14]
             + "** 5 = " + board.board_array_master[_x,_y,5]
             + "** 6 down = " + board.board_array_master[_x,_y,6]
             + "** 7 up = " + board.board_array_master[_x,_y,7]
             + "** 8 right = " + board.board_array_master[_x,_y,8]
             + "** 9 left = " + board.board_array_master[_x,_y,9]
             +                  );*/

            /*
             *                  Board_C debug = (Board_C)boardthis_board.GetComponent("Board_C");
             *                  if (debug.debug)//change gem color when click over it
             *                  {
             *                          if (boardarray_master[_x,_y,1] +1 == board.gem_length)
             *                                  boardarray_master[_x,_y,1]  = 0;
             *                          else
             *                                  boardarray_master[_x,_y,1] ++;
             *
             *                          SpriteRenderer sprite_gem = my_gem.GetComponent<SpriteRenderer>();
             *                                  sprite_gem.sprite = board.gem_colors[boardarray_master[_x,_y,1]];
             *
             *
             *                  }
             *                  else
             *                  {
             *                  Debug.Log(_x + "," + _y
             + "** 1 = " + boardarray_master[_x,_y,1]
             + "** 2 = " + boardarray_master[_x,_y,2]
             + "** 3 = " + boardarray_master[_x,_y,3]
             + "** 4 = " + boardarray_master[_x,_y,4]
             + "** 5 = " + boardarray_master[_x,_y,5]
             + "** 6 = " + boardarray_master[_x,_y,6]
             + "** 7 = " + boardarray_master[_x,_y,7]
             + "** 8 = " + boardarray_master[_x,_y,8]
             + "** 9 = " + boardarray_master[_x,_y,9]
             + "** 10 = " + boardarray_master[_x,_y,10]
             + "** 11 = " + boardarray_master[_x,_y,11]
             + "** 12 = " + boardarray_master[_x,_y,12]
             + "** 13 = " + boardarray_master[_x,_y,13]
             + "** 14 = " + boardarray_master[_x,_y,14]
             + "** 15 = " + boardarray_master[_x,_y,15]
             + "** 16 = " + boardarray_master[_x,_y,16]
             + "** 17 = " + boardarray_master[_x,_y,17]
             +                            );
             +                  }*/

            if (board.board_array_master[_x, _y, 11] != 0)
            {
                return;
            }

            if (board.player_turn && (board.player_can_move || board.player_can_move_when_gem_falling))
            {
#if UNITY_WEBGL
                board.Play_sfx(board.click_sfx_str);
#else
                board.Play_sfx(board.click_sfx);
#endif

                board.n_combo = 0;//interact break the combo

                if ((board.board_array_master[_x, _y, 1] >= 0) && (board.board_array_master[_x, _y, 1] <= 9) &&  //if this is a gem
                    (board.board_array_master[_x, _y, 3] == 0))                                                                                                           //no padlock
                {
                    if ((board.trigger_by_select == Board_C.trigger_by.click) && (board.board_array_master[_x, _y, 1] == 9) && (board.board_array_master[_x, _y, 4] > 0)) // click on a clickable bonus
                    {
                        //Debug.Log("click bonus");
                        Cancell_old_selection();

                        Trigger_bonus(true);

                        return;
                    }

                    if (board.main_gem_selected_x < 0)    //if none gem is selected
                    {
                        I_become_main_gem();
                    }
                    else if ((board.main_gem_selected_x == _x) && (board.main_gem_selected_y == _y))
                    {
                        //you have click on the gem already selected
                    }
                    else if ((board.main_gem_selected_x - 1 == _x) && (board.main_gem_selected_y == _y))
                    {
                        //click on the gem next left of the main gem
                        I_become_minor_gem(7);
                    }
                    else if ((board.main_gem_selected_x + 1 == _x) && (board.main_gem_selected_y == _y))
                    {
                        //click on the gem next right of main gem
                        I_become_minor_gem(6);
                    }
                    else if ((board.main_gem_selected_x == _x) && (board.main_gem_selected_y - 1 == _y))
                    {
                        //click on the gem next up main gem
                        I_become_minor_gem(5);
                    }
                    else if ((board.main_gem_selected_x == _x) && (board.main_gem_selected_y + 1 == _y))
                    {
                        //click on the gem next down main gem
                        I_become_minor_gem(4);
                    }
                    else     //click on a gem not adjacent the gem already selected, so this gem will be the new main gem
                    {
                        I_become_main_gem();
                    }
                }
                else
                {
                    Cancell_old_selection();
                }
            }
            else if (board.player_can_move && board.current_moveStatus == Board_C.moveStatus.waitingNewMove)
            {
                Cancell_old_selection();
                //Try_to_use_bonus_on_this_tile();
            }
        }
        //Debug.Log("---- tile_C.MyOnMouseDown");
    }