Exemplo n.º 1
0
    void AnimateScoreForChain(Chain chain)
    {
        Animal firstAnimal = chain.Animals()[0];
        Animal lastAnimal  = chain.Animals()[chain.Animals().Count - 1];

        Vector2 centerPosition = (firstAnimal.view.transform.position + lastAnimal.view.transform.position) / 2f;

        GameObject scoreText = scoreTextPrefab.Spawn(mainCanvas.transform);

        scoreText.transform.position         = centerPosition;
        scoreText.GetComponent <Text>().text = chain.score.ToString();
        scoreText.transform.DOBlendableMoveBy(new Vector2(0f, 1f), 0.7f).SetEase(Ease.OutExpo).OnComplete(() => scoreText.Recycle());
    }