예제 #1
0
    public void AddScoreText(int x, int y, int colnumber, int chainLevel)
    {
        Color[]    colorList = { Color.green, Color.yellow, new Color(1.0f, 0.6f, 0.0f), Color.red, new Color(0.5f, 0.0f, 0.5f), Color.cyan, Color.blue, Color.gray, Color.gray, Color.gray, Color.gray, Color.gray };
        GameObject newObject = (GameObject)Instantiate(scorePrefab, GetWorldPosition((float)x + 1.5f, (float)y - .5f), Quaternion.identity);
        GameObject scoreText = newObject.transform.FindChild("Text").gameObject;

        UnityEngine.UI.Text thetext = scoreText.GetComponent <UnityEngine.UI.Text>();
        long localScore             = computeScore(chainLevel);

        currentGameStats.currentScore += localScore;
        thetext.text  = localScore.ToString();
        thetext.color = colorList[colnumber - 1];
        DisplayScore(currentGameStats.currentScore);

        if (chainLevel > 1)
        {
            if (UIDisplayComponent)
            {
                UIDisplayComponent.ChainNumberText = "Chain x" + chainLevel.ToString();
                UIDisplayComponent.CrossFadeLevelText(1.0f, 0.05f);
            }
        }

        newObject.transform.SetParent(transform);
    }