Exemplo n.º 1
0
    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++;
        }
    }
Exemplo n.º 2
0
 private static void AddScore(string text, Vector3 hitPosition)
 {
     FloatingText.Print(text, hitPosition);
 }
Exemplo n.º 3
0
 private static void AddScore(string text)
 {
     FloatingText.Print(text, lastHitPos);
 }