public void NewFloatingScore() { Vector2 viewportPosition = this._mainCamera.WorldToViewportPoint(new Vector3(this._playerTransform.position.x + Random.Range(-.2f, .2f), this._playerTransform.position.y + Random.Range(-.2f, .2f), this._playerTransform.position.z + Random.Range(-.2f, .2f))); FloatingScore instance = Instantiate(this._floatingScoreTextPrefab); instance.transform.SetParent(this.transform, false); instance.GetComponent <RectTransform>().anchorMin = viewportPosition; instance.GetComponent <RectTransform>().anchorMax = viewportPosition; instance.Displacement = Random.Range(this._minHorizontalDisplacement, this._maxHorizontalDisplacement); }
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; }
// Add to the score for this 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 "3 x 2" string txt = wyrd.letters.Count.ToString(); if (combo > 1) { txt += " x " + combo; } fs.GetComponent <GUIText>().text = txt; }
void Score(Wyrd wyrd, int combo) { List <Vector2> pts = new List <Vector2>(); Vector3 pt = wyrd.letters[0].transform.position; pt = Camera.main.WorldToViewportPoint(pt); pts.Add(pt); pts.Add(scoreMidPoint); pts.Add(rectTrans.anchorMax); int value = wyrd.letters.Count * combo; FloatingScore fs = Scoreboard.S.CreateFloatingScore(value, pts); fs.timeDuration = scoreTravelTime; fs.timeStart = Time.time + combo * scoreComboDelay; fs.fontSizes = scoreFontSizes; fs.easingCurve = Easing.InOut + Easing.InOut; string txt = wyrd.letters.Count.ToString(); if (combo > 1) { txt += " x " + combo; } fs.GetComponent <Text>().text = txt; }
// Add to the score for this word // int combo is the number of this word in a combo void Score(Wyrd wyrd, int combo) { // Create a List<> of Vector2 Bezier points for the FloatingScore. List <Vector2> pts = new List <Vector2>(); // Get the position of the first Letter in the wyrd Vector3 pt = wyrd.letters[0].transform.position; // a pt = Camera.main.WorldToViewportPoint(pt); pts.Add(pt); // Make pt the first Bezier point // b // Add a second Bezier point pts.Add( scoreMidPoint ); // Make the Scoreboard the last Bezier point pts.Add(rectTrans.anchorMax); // Set the value of the Floating Score int value = wyrd.letters.Count * combo; FloatingScore fs = Scoreboard.S.CreateFloatingScore(value, pts); fs.timeDuration = scoreTravelTime; fs.timeStart = Time.time + combo * scoreComboDelay; fs.fontSizes = scoreFontSizes; // Double the InOut Easing effect fs.easingCurve = Easing.InOut + Easing.InOut; // Make the text of the FloatingScore something like "3 x 2" string txt = wyrd.letters.Count.ToString(); if (combo > 1) { txt += " x " + combo; } fs.GetComponent <Text>().text = txt; }
// Добавляем счёт за это слово // число combo это номер слова по счёту void Score(Wyrd wyrd, int combo) { // Узнаём позицию первой буквы в wyrd Vector3 pt = wyrd.letters[0].transform.position; // Создаём список бизер точек для плавающего счёта List <Vector3> pts = new List <Vector3>(); // Сонвертируем pt в Видовую точку в ренже 0- 1 // используется для GUI координат pt = Camera.main.WorldToViewportPoint(pt); pt.z = 0; // Делаем pt первой точкой ( как раз позиция буквы ) pts.Add(pt); // Добавляем вторую точку ( для дуги ) pts.Add(scoreMidPoint); // Добавляем последнюю точку ( типо происходит слияние счетов // и они складываются ) pts.Add(Scoreboard.S.transform.position); // Задаём значение для floating score 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; // Делаем текст типо "3 х 2" string txt = wyrd.letters.Count.ToString(); if (combo > 1) { txt += " x " + combo; } fs.GetComponent <Text>().text = txt; }
// Add to the score for this word // int combo is the number of this word in a combo void Score(Wyrd wyrd, int combo) { // Create a List<> of Bezier points for the FloatingScore List <Vector2> pts = new List <Vector2>(); // Get the position of the first Letter in the wyrd Vector3 pt = wyrd.letters[0].transform.position; // a pt = Camera.main.WorldToViewportPoint(pt); pts.Add(pt); // Make pt the first Bezier point // b // Add a second Bezier point pts.Add(scoreMidPoint); // Make the Scoreboard the last Bezier point pts.Add(rectTrans.anchorMax); // Set the value of the Floating Score int value = wyrd.letters.Count * combo; FloatingScore fs = Scoreboard.S.CreateFloatingScore(value, pts); fs.timeDuration = scoreTravelTime; fs.timeStart = Time.time + combo * scoreComboDelay; fs.fontSizes = scoreFontSizes; // Double the InOut Easing effect fs.easingCurve = Easing.InOut + Easing.InOut; // Make the text of the FloatingScore something like "3 x 2" string txt = wyrd.letters.Count.ToString(); if (combo > 1) { txt += " x " + combo; } fs.GetComponent <Text>().text = txt; }