Example #1
0
    public static void RemoveTilesPastIndex(int index)
    {
        if (index >= currentSelection.Count)
        {
            //Debug.Log("Error: tried to remove tiles past index out of bounds.");
            return;
        }

        for (int i = currentSelection.Count - 1; i > index; --i)
        {
            // get the last selected letter tile and remove it from the list (and unhighlight it)
            Vector2   v   = currentSelection[currentSelection.Count - 1];
            BoxScript box = grid[(int)v.x, (int)v.y].gameObject.GetComponent <BoxScript>();
            box.ResetTileColors();
            box._isSelected = false;
            currentSelection.Remove(v);

            /******************************************************************
            * FEATURE: If juiciness is on, play particles when deselecting!
            ******************************************************************/
            if (GameManagerScript.juiceProductive || GameManagerScript.juiceUnproductive)
            {
                box.PlayShinySelectParticles();
            }
        }

        // log the removed letters
        Logger.LogAction("BNW_LetterDeselected", currentWord.Substring(index + 1), -1, -1);

        // Remove the letters
        currentWord = currentWord.Substring(0, index + 1);

        /*****************************************************************
        * FEATURE: Highlighting color gradient based on frequency feature
        *****************************************************************/
        DisplayHighlightFeedback();

        /******************************************************************
        * FEATURE: Display currently selected score
        ******************************************************************/
        DisplaySelectedScore();

        /******************************************************************
        * FEATURE: Obstructions- enable/disable play button based on word
        ******************************************************************/
        if (GameManagerScript.obstructionProductive || GameManagerScript.obstructionUnproductive)
        {
            GameManagerScript.gameManager.UpdatePlayButton();
        }

        // Play sound effect
        AudioManager.instance.Play("Select");
    }
Example #2
0
    /**
     * Method that selects the tile at the given coordinate (pos)
     */
    public static void SelectTile(Vector2 pos)
    {
        currentSelection.Add(pos);
        GameObject gameObject = grid[(int)pos.x, (int)pos.y].gameObject;
        BoxScript  boxScript  = gameObject.GetComponent <BoxScript>();

        currentWord += boxScript.Letter;

        /*****************************************************************
        * FEATURE: Highlighting color gradient based on frequency feature
        *****************************************************************/
        DisplayHighlightFeedback();

        // ALSO: display the border around the tile
        boxScript.DisplayBorder();

        /******************************************************************
        * FEATURE: Obstructions- disable / enable button depending on
        *          word's validity
        ******************************************************************/
        if (GameManagerScript.obstructionProductive || GameManagerScript.obstructionUnproductive)
        {
            GameManagerScript.gameManager.UpdatePlayButton();
        }

        /*****************************************************************
        * FEATURE: Shiny particles whenever you select a tile!
        * Productive Juice. Unproductive juice produces particles every touch
        *****************************************************************/
        if (GameManagerScript.juiceProductive)
        {
            boxScript.PlayShinySelectParticles();
        }

        /******************************************************************
        * FEATURE: juice: turn on this flag so that the tile
        *          bounces around/animates when selected
        ******************************************************************/
        boxScript._isSelected = true;

        //=====================================================================
        //  FEATURE: Juice: extra animations/bouncing if tile is selected.
        //=====================================================================
        if (GameManagerScript.juiceUnproductive || GameManagerScript.juiceProductive)
        {
            // Animate the tile
            boxScript.StartCoroutine(boxScript.AnimateBouncingTile());
        }

        //=====================================================================
        //  FEATURE: Unproductive Juice: camera shakes and explosions when
        //           selecting letters.
        //=====================================================================
        if (GameManagerScript.juiceUnproductive)
        {
            CameraShaker.instance.ShakeOnce(3f, 3.5f, .1f, .3f);
        }

        // Play sound effect
        AudioManager.instance.Play("Select");

        DisplaySelectedScore();
    }