void Score(Wyrd wyrd, int combo) { Vector3 pt = wyrd.letters [0].transform.position; List<Vector3> pts = new List<Vector3> (); pt = Camera.main.WorldToViewportPoint (pt); pt.z = 0; pts.Add (pt); pts.Add (scoreMidPoint); pts.Add (Scoreboard.S.transform.position); int value = wyrd.letters.Count * combo; FloatingScore fs = Scoreboard.S.CreateFloatingScore (value, pts); fs.timeDuration = 2f; fs.fontSizes = scoreFontSizes; fs.easingCurve = Easing.InOut + Easing.InOut; string txt = wyrd.letters.Count.ToString (); if (combo > 1) { txt += " x "+combo; } fs.GetComponent<GUIText>().text = txt; }
void Layout(){ wyrds = new List<Wyrd> (); GameObject go; Letter lett; string word; Vector3 pos; float left = 0; float columnWidth = 3; char c; Color col; Wyrd wyrd; int numRows = Mathf.RoundToInt (wordArea.height / letterSize); for (int i=0; i<currLevel.subWords.Count; i++){ wyrd = new Wyrd(); word = currLevel.subWords[i]; columnWidth = Mathf.Max(columnWidth,word.Length); for (int j=0; j<word.Length; j++){ c = word[j]; go = Instantiate(prefabLetter) as GameObject; lett = go.GetComponent<Letter>(); lett.c = c; pos = new Vector3(wordArea.x+left+j*letterSize,wordArea.y,0); pos.y -= (i % numRows) * letterSize; lett.pos = pos; go.transform.localScale = Vector3.one * letterSize; wyrd.Add (lett); } if (showAllWyrds) wyrd.visable = true; wyrds.Add (wyrd); if (i % numRows == numRows - 1){ left += (columnWidth + 0.5f) * letterSize; } } bigLetters = new List<Letter>(); bigLettersActive = new List<Letter> (); for (int i=0; i<currLevel.word.Length; i++) { c = currLevel.word[i]; go = Instantiate (prefabLetter) as GameObject; lett = go.GetComponent<Letter>(); lett.c = c; go.transform.localScale = Vector3.one * bigLetterSize; pos = new Vector3 (0, -100, 0); lett.pos = pos; col = bigColorDim; lett.color = col; lett.visable = true; lett.big = true; bigLetters.Add (lett); } bigLetters = ShuffleLetters (bigLetters); ArrangeBigLetters (); mode = GameMode.inLevel; }
//add the score for ths word //int combo is the number of this word in a combo void Score(Wyrd wyrd, int combo) { //get the position of the first letter in the wyrd Vector3 pt = wyrd.letters [0].transform.position; //create a List<> of Bezier points for the FloatingScore List<Vector3> pts = new List<Vector3> (); //convert the pt to a ViewportPoint. ViewportPoints range from 0 to 1 //across the screen and are used for GUI coordinates pt = Camera.main.WorldToViewportPoint (pt); pt.z = 0; //make pt the first Bezier point pts.Add (pt); //add a second Bezier point pts.Add (scoreMidPoint); //make the Scoreboard the last Bezier point pts.Add (Scoreboard.S.transform.position); //set the value of the floating score int value = wyrd.letters.Count * combo; FloatingScore fs = Scoreboard.S.CreateFloatingScore (value, pts); fs.timeDuration = 2f; fs.fontSizes = scoreFontSizes; //double the InOut Easing Effect fs.easingCurve = Easing.InOut + Easing.InOut; //make the text of the FloatingScore something like "3x2" string txt = wyrd.letters.Count.ToString (); if (combo > 1) { txt += "x" + combo; } fs.guiText.text = txt; }
void Layout() { //place the letters for each subword of currLevel on screen wyrds = new List<Wyrd> (); //declare a lot of variables that will be used in this method GameObject go; Letter lett; string word; Vector3 pos; float left = 0; float columnWidth = 3; char c; Color col; Wyrd wyrd; //determine how many rows of letters will fit on screen int numRows = Mathf.RoundToInt (wordArea.height / letterSize); //make a Wyrd of each level.subWord for (int i=0; i<currLevel.subWords.Count; i++) { wyrd = new Wyrd (); word = currLevel.subWords [i]; //if the word is longer than columnWidth, expand it columnWidth = Mathf.Max (columnWidth, word.Length); //instantiate a prefabLetter for each letter of the word for (int j=0; j<word.Length; j++) { c = word [j]; //grab the jth char of the word go = Instantiate (prefabLetter) as GameObject; lett = go.GetComponent<Letter> (); lett.c = c; //set the c of the Letter //position the Letter pos = new Vector3 (wordArea.x + left + j * letterSize, wordArea.y, 0); //the modulus here makes multiple columns line up pos.y -= (i % numRows) * letterSize; //move the lett immediately to a position above the screen lett.position = pos+Vector3.up*(20+i%numRows); //then set the pos for it to interpolate to lett.pos = pos; //increment lett.timeStart to move wyrds at different times lett.timeStart = Time.time + i*0.05f; go.transform.localScale = Vector3.one * letterSize; wyrd.Add (lett); } if (showAllWyrds) wyrd.visible = true; //this line is for testing //color the wyrd based on length wyrd.color = wyrdPalette[word.Length-WordList.S.wordLengthMin]; wyrds.Add (wyrd); //if we've gotten to the numRows(th) row, start a new column if (i % numRows == numRows - 1) { left += (columnWidth + 0.5f) * letterSize; } } //place the big letters //initialize the List<>s for big letters bigLetters = new List<Letter> (); bigLettersActive = new List<Letter> (); //create a big letter for each letter in the target word for (int i = 0; i<currLevel.word.Length; i++) { //this is similar to the process for a normal letter c = currLevel.word [i]; go = Instantiate (prefabLetter) as GameObject; lett = go.GetComponent<Letter> (); lett.c = c; go.transform.localScale = Vector3.one * bigLetterSize; //set the initial position of the big letters below screen pos = new Vector3 (0, -100, 0); lett.pos = pos; //added in, to ease up from the bottom of the screen lett.position = pos+Vector3.up*(20+i%numRows); //increment lett.timestart to have big letters come in last lett.timeStart = Time.time + currLevel.subWords.Count*0.05f; lett.easingCurve = Easing.Sin+"-0.18"; //bouncy easing col = bigColorDim; lett.color = col; lett.visible = true; lett.big = true; bigLetters.Add (lett); } //shuffle the big Letters bigLetters = ShuffleLetters (bigLetters); //arrange them on screen ArrangeBigLetters (); //set the mode to be in-game mode = GameMode.inLevel; }
static public void SCORE(Wyrd wyrd, int combo) { S.Score(wyrd, combo); }
void Layout() { wyrds = new List <Wyrd>(); GameObject go; Letter lett; string word; Vector3 pos; float left = 0; float columnWidth = 3; char c; Color col; Wyrd wyrd; int numRows = Mathf.RoundToInt(wordArea.height / letterSize); for (int i = 0; i < currLevel.subWords.Count; i++) { wyrd = new Wyrd(); word = currLevel.subWords[i]; columnWidth = Mathf.Max(columnWidth, word.Length); for (int j = 0; j < word.Length; j++) { c = word[j]; go = Instantiate <GameObject>(PrefabLetter); go.transform.SetParent(letterAnchor); lett = go.GetComponent <Letter>(); lett.c = c; // Set the c of the Letter pos = new Vector3(wordArea.x + left + j * letterSize, wordArea.y, 0); pos.y -= (i % numRows) * letterSize; lett.posImmediate = pos + Vector3.up * (20 + i % numRows); lett.pos = pos; lett.timeStart = Time.time + i * 0.5f; go.transform.localScale = Vector3.one * letterSize; wyrd.Add(lett); } if (showAllWyrds) { wyrd.visible = true; } wyrd.color = wyrdPalette[word.Length - WordList.WORD_LENGTH_MIN]; wyrds.Add(wyrd); if (i % numRows == numRows - 1) { left += (columnWidth + 0.5f) * letterSize; } } bigLetters = new List <Letter>(); bigLettersActive = new List <Letter>(); for (int i = 0; i < currLevel.word.Length; i++) { // This is similar to the process for a normal Letter c = currLevel.word[i]; go = Instantiate <GameObject>(PrefabLetter); go.transform.SetParent(bigLetterAnchor); lett = go.GetComponent <Letter>(); lett.c = c; go.transform.localScale = Vector3.one * bigLetterSize; // Set the initial position of the big Letters below screen pos = new Vector3(0, -100, 0); lett.pos = pos; lett.timeStart = Time.time + currLevel.subWords.Count * 0.05f; lett.easingCuve = Easing.Sin + "-.18"; col = bigColorDim; lett.color = col; lett.visible = true; // This is always true for big letters lett.big = true; bigLetters.Add(lett); } bigLetters = ShuffleLetters(bigLetters); ArrangeBigLetters(); mode = GameMode.inLevel; }
void Layout() { wyrds = new List <Wyrd>(); GameObject go; Letter lett; string word; Vector3 pos; float left = 0; float columnWidth = 3; char c; Color col; Wyrd wyrd; int numRows = Mathf.RoundToInt(wordArea.height / letterSize); //make a Wyrd of each level.subWord for (int i = 0; i < currLevel.subWords.Count; i++) { wyrd = new Wyrd(); word = currLevel.subWords[i]; columnWidth = Mathf.Max(columnWidth, word.Length); for (int j = 0; j < word.Length; j++) { c = word[j]; go = Instantiate <GameObject>(prefabLetter); go.transform.SetParent(letterAnchor); lett = go.GetComponent <Letter>(); lett.c = c; pos = new Vector3(wordArea.x + left + j * letterSize, wordArea.y, 0); pos.y -= (i % numRows) * letterSize; lett.posImmediate = pos + Vector3.up * (20 + i % numRows); lett.pos = pos; //add more to this line later lett.timeStart = Time.time + i * .05f; go.transform.localScale = Vector3.one * letterSize; wyrd.Add(lett); } if (showAllWyrds) { wyrd.visible = true; } wyrd.color = wyrdPalette[word.Length - WordList.WORD_LENGTH_MIN]; wyrds.Add(wyrd); //adds new collumn if previous one is maxed if (i % numRows == numRows - 1) { left += (columnWidth + .5f) * letterSize; } } bigLetters = new List <Letter>(); bigLettersActive = new List <Letter>(); //create a big letter for each letter in big word for (int i = 0; i < currLevel.word.Length; i++) { c = currLevel.word[i]; go = Instantiate <GameObject>(prefabLetter); go.transform.SetParent(bigLetterAnchor); lett = go.GetComponent <Letter>(); lett.c = c; go.transform.localScale = Vector3.one * bigLetterSize; //set initial position of big letters below the screen pos = new Vector3(0, -100, 0); lett.posImmediate = pos; lett.pos = pos; //will add code here later lett.timeStart = Time.time + currLevel.subWords.Count * .05f; lett.easingCurve = Easing.Sin + "-0.18"; col = bigColorDim; lett.color = col; lett.visible = true; lett.big = true; bigLetters.Add(lett); } //shuffle letters bigLetters = ShuffleLetters(bigLetters); //arrange onto screen ArrangeBigLetters(); mode = GameMode.inLevel; }