void Awake()
 {
     if (global == null)
     {
         global          = this;
         fadeHandler     = transform.Find("Fade").GetComponent <ScreenFade>();
         mapHandler      = transform.Find("Map").GetComponent <MapHandler>();
         pauseHandler    = transform.Find("Pause").gameObject;
         settingsHandler = transform.Find("Settings").GetComponent <SettingsHandler>();
         copyright       = transform.Find("Text").GetComponent <TextMeshProUGUI>();
         joystick        = transform.Find("GameButtons").Find("Left Joystick").GetComponent <LeftJoystick>();
         bgmHandler      = GetComponent <BgmHandler>();
         #if UNITY_ANDROID
         Debug.Log("Android");
         #else
         joystick.gameObject.SetActive(false);
         transform.Find("GameButtons").Find("Jump").gameObject.SetActive(false);
         #endif
         if (!isIntro)
         {
             digitalGlitch    = GameObject.FindWithTag("MainCamera").GetComponent <DigitalGlitch>();
             analogGlitch     = GameObject.FindWithTag("MainCamera").GetComponent <AnalogGlitch>();
             postProcessing   = GameObject.FindWithTag("Post Processing").GetComponent <PostProcessVolume>();
             postProcessLayer = GameObject.FindWithTag("MainCamera").GetComponent <PostProcessLayer>();
         }
         if (SceneManager.GetActiveScene().name != "title")
         {
             StartCoroutine(fadeHandler.Fade(true, 0.5f));
             if (busy)
             {
                 StartCoroutine(FadeAndUnbusy());
             }
         }
     }
 }
Exemplo n.º 2
0
    void Awake()
    {
        if (main == null)
        {
            main = this;
        }
        else if (main != this)
        {
            Destroy(gameObject);
        }

        source      = this.GetComponent <AudioSource>();
        source.loop = false;
    }