public void EatGhost(Vector3 position) { AddScore(ghostScores[eatenGhostCount]); Vector2 floatingPosition = gameCamera.WorldToScreenPoint(position); floatingPosition.x += gameScreen.rectTransform.offsetMin.x; floatingPosition.y += gameScreen.rectTransform.offsetMin.y; FloatingText scoreValue = Instantiate(scoreValuePrefab); scoreValue.transform.SetParent(canvas.transform); scoreValue.transform.localScale = new Vector3(1, 1, 1); scoreValue.GetComponent <RectTransform>().anchoredPosition = floatingPosition; scoreValue.Print(ghostScores[eatenGhostCount].ToString()); if (eatenGhostCount + 1 < ghostScores.Length) { eatenGhostCount++; } }
private static void AddScore(string text, Vector3 hitPosition) { FloatingText.Print(text, hitPosition); }
private static void AddScore(string text) { FloatingText.Print(text, lastHitPos); }