public static void ClearAllSelectedTiles() { currentWord = ""; // remove all coloring foreach (Vector2 v in currentSelection) { BoxScript box = grid[(int)v.x, (int)v.y].gameObject.GetComponent <BoxScript>(); box.ResetTileColors(); box._isSelected = false; } currentSelection.Clear(); /****************************************************************** * FEATURE: Display currently selected score ******************************************************************/ // Calculate currently selected score and change the text on screen selectedScore.text = ""; /****************************************************************** * FEATURE: Disable the play word button if it exists ******************************************************************/ if (GameManagerScript.obstructionProductive || GameManagerScript.obstructionUnproductive) { GameManagerScript.gameManager.UpdatePlayButton(); } }
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"); }
public static void RemoveLastSelection() { /****************************************************************** * FEATURE: If juiciness is on, play particles when deselecting! ******************************************************************/ if (GameManagerScript.juiceProductive || GameManagerScript.juiceUnproductive) { Vector2 last = currentSelection[currentSelection.Count - 1]; grid[(int)last.x, (int)last.y].gameObject.GetComponent <BoxScript>().PlayShinySelectParticles(); } // 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); // log the last removed letter Logger.LogAction("BNW_LetterDeselected", currentWord.Substring(currentWord.Length - 1, 1), (int)v.x, (int)v.y); // Remove the last letter currentWord = currentWord.Substring(0, currentWord.Length - 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"); }