Ejemplo n.º 1
0
        public static SoundManager getInstance()
        {
            if (sm == null)
                sm = new SoundManager();

            return sm;
        }
Ejemplo n.º 2
0
        public float HighPitchRange = 1.05f;            //The highest a sound effect will be randomly pitched.

        private void Awake()
        {
            //Check if Instance already exists
            if (Instance == null)
            {
                //if not, set Instance to this
                Instance = this;
            }
            //If Instance already exists and it's not this:
            else
            {
                if (Instance != this)
                {
                    //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one Instance of a GameManager.
                    Destroy(this.gameObject);
                }
            }

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(this.gameObject);
        }
Ejemplo n.º 3
0
 void Start()
 {
     _sharedManager = this;
 }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     _sceneManager = transform.root.GetComponent<SceneManager>();
     _soundManager = _sceneManager.GetComponent<SoundManager>();
 }