ScoreSystem.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
    void Start()
    {
    }

Usage Example

Exemplo n.º 1
0
    //private RectTransform deathPanel = null;

    // Use this for initialization
    void Start()
    {
        foreach (Image ri in gameObject.GetComponentsInChildren <Image>())
        {
            if (ri.gameObject.name == "Restart" || ri.gameObject.name == "HighScore" || ri.gameObject.name == "Quit")
            {
                ri.alphaHitTestMinimumThreshold = 0.5f;
            }
        }

        foreach (GameObject go in SceneManager.GetActiveScene().GetRootGameObjects())
        {
            foreach (Transform child in go.GetComponentsInChildren <Transform>())
            {
                if (scoreSys == null && child.name == "KMsText")
                {
                    scoreSys = new ScoreSystem(child.GetComponent <Text>());
                }
            }
        }

        for (int i = 0; i < 10; ++i)
        {
            highScores.Add(PlayerPrefs.GetFloat(GlobalScript.TableTag + GlobalScript.ScoreTag + i, float.NaN));
        }

        scoreSys.Start();

        GameObject[] rootGameObjects = gameObject.scene.GetRootGameObjects();
        foreach (GameObject go in rootGameObjects)
        {
            if (pgInstance == null)
            {
                pgInstance = go.GetComponentInChildren <ProceduralGenerator>();
            }
            if (bmInstance == null)
            {
                bmInstance = go.GetComponentInChildren <ButtonMovement>();
            }

            if (pgInstance != null && bmInstance != null)
            {
                break;
            }
        }

        DeathMenuUI.SetActive(false);
    }