示例#1
0
 private void Awake()
 {
     if (null == instance)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#2
0
        /// <summary>
        ///     Gets components of the event.
        /// </summary>
        private void GetComponents()
        {
            _levelTransition = GameObject.Find("FadeCanvas").GetComponentInChildren <LevelTransition>();
            _cutsceneHandler = GameObject.FindGameObjectWithTag("CursceneHandler").GetComponent <CutsceneHandler>();
            _enemyHealth     = new List <EnemyHealth>();
            _enemyCount      = enemies.Count;
            for (var i = 0; i < enemies.Count; i++)
            {
                _enemyHealth.Add(enemies[i].GetComponent <EnemyHealth>());
                _enemyHealth[i].fromEvent = true;
            }

            _audioManager = FindObjectOfType <AudioManager>();
            _audioManager.SetBgTrack(bgTrack);
            if (playDuringCutscene || !hasIntro)
            {
                _audioManager.Mute(false);
            }
        }