private void Awake()
        {
            if (GameObject.FindGameObjectsWithTag("GAME_HANDLER").Length > 1)
            {
                if (debug)
                {
                    Debug.Log("There is more then one Game Handler. Removing excessive.");
                }
                Destroy(gameObject);
            }
            else
            {
                DontDestroyOnLoad(gameObject);

                GameState.Initiate(startingState);
                InputController.Initiate();
                EnergyHandler.Initiate();
                SoundMechanicHandler.Initiate();
                LevelHandler.Initiate();
                PrefabHolder.Initiate(
                    heatArea,
                    soundElement,
                    energyBullet,
                    energyLaser,
                    energyDetectionVisualization,
                    mainMixer
                    );

                SceneManager.sceneLoaded += CollectLevelProperties;
            }
        }
        private void CollectLevelProperties(Scene arg0, LoadSceneMode arg1)
        {
            GameObject levelCollector = GameObject.FindGameObjectWithTag("LEVEL_COLLECTOR");

            if (levelCollector == null)
            {
                if (debug)
                {
                    Debug.Log("No LevelCollector found");
                }
                //Clear the LevelHandler to avoid Leftover information from old level remaining;
                LevelHandler.Clear();
                return;
            }

            if (debug)
            {
                Debug.Log("Collecting level properties from: " + levelCollector.name);
            }

            levelCollector.SendMessage("Collect");
            LevelHandler.Start();
            SoundMechanicHandler.Initiate();
        }
Beispiel #3
0
 private void OnCollisionEnter(Collision collision)
 {
     SoundMechanicHandler.PlaySound(transform, collision.contacts[0].point, Mathf.Min(10, collision.relativeVelocity.magnitude / 4), impactSoundRange, true);
     source.Play();
 }
Beispiel #4
0
 public static void Initiate()
 {
     instance = new SoundMechanicHandler();
 }