Пример #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #2
0
    void Awake()
    {
        saveScript = GetComponent <SaveScript>();
        webScript  = GetComponent <WebScript>();

        playerParent  = GameObject.Find("Entities");
        enemyParent   = GameObject.Find("Enemies");
        powerupParent = GameObject.Find("Powerups");

        playerSpawns  = GameObject.FindGameObjectsWithTag("PlayerSpawn");
        enemySpawns   = GameObject.FindGameObjectsWithTag("EnemySpawn");
        powerupSpawns = GameObject.FindGameObjectsWithTag("PowerupSpawn");

        panels    = GameObject.FindGameObjectsWithTag("Panel");
        animators = new Animator[panels.Length];
        for (int i = 0; i < panels.Length; i++)
        {
            animators[i] = panels[i].GetComponent <Animator>();
        }

        nameInput      = GameObject.Find("NameInput").GetComponent <InputField>();
        nameInput.text = PlayerPrefs.GetString("username", "USR");

        scoreScript = GameObject.Find("ScorePanel").GetComponent <ScoreScript>();

        globalImage = GameObject.Find("Global").GetComponent <Image>();
        localImage  = GameObject.Find("Local").GetComponent <Image>();

#if UNITY_WEBGL
        Destroy(localImage.gameObject);
#endif
    }