Exemple #1
0
    void Start()
    {
        instance = this;

        //Music
        mainBassSrc             = gameObject.AddComponent <AudioSource>();
        mainDrumsSrc            = gameObject.AddComponent <AudioSource>();
        mainMelodySrc           = gameObject.AddComponent <AudioSource>();
        mainBassSrc.clip        = mainBass;
        mainDrumsSrc.clip       = mainDrums;
        mainMelodySrc.clip      = mainMelody;
        mainBassSrc.loop        = mainDrumsSrc.loop = mainMelodySrc.loop = true;
        mainBassSrc.playOnAwake = mainDrumsSrc.playOnAwake = mainMelodySrc.playOnAwake = false;
        mainBassSrc.Play();
        mainDrumsSrc.Play();
        mainMelodySrc.Play();
        BASS   = new Voice(mainBassSrc, 0.1f);
        DRUMS  = new Voice(mainDrumsSrc, 0.1f);
        MELODY = new Voice(mainMelodySrc, 0f);
        voices = new Voice[] { BASS, DRUMS, MELODY };

        FADE_MUSIC(0.07f, BASS, 0.8f);
        FADE_MUSIC(0.03f, DRUMS, 0.5f);

        //Sounds
        names = new string[sounds.Length];
        for (int i = 0; i < sounds.Length; i++)
        {
            names[i] = sounds[i].name;
        }
    }
Exemple #2
0
    //[Space]
    #endregion

    //================================

    #region Unity Methods:

    // Start is called before the first frame update
    private void Awake()
    {
        //Checks if theres a duplicate of AudioManager before starting another
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }
        //Won't destroy when loading into next scene
        DontDestroyOnLoad(gameObject);

        //Setup for Audio Sources
        foreach (sound01 s in sounds)
        {
            s.source        = gameObject.AddComponent <AudioSource>();
            s.source.clip   = s.clip;
            s.source.volume = s.volume;
            s.source.pitch  = s.pitch;
            s.source.loop   = s.loop;
        }
    }
    void Awake()
    {
        //the audio manager does not get lost as the scene changes
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            //if there is another auido manager in the changed scene delete it
            Destroy(gameObject);
            return;
        }
        DontDestroyOnLoad(gameObject);



        foreach (sound s in sounds)
        {
            s.source      = gameObject.AddComponent <AudioSource>();
            s.source.clip = s.clip;

            s.source.pitch  = s.pitch;
            s.source.volume = s.volume;
        }
    }
Exemple #4
0
    void Awake()
    {
        if (amInstance == null)
        {
            amInstance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        foreach (Sound s in sounds)
        {
            s.source      = gameObject.AddComponent <AudioSource>();
            s.source.clip = s.clip;

            s.source.volume = s.volume;
            s.source.loop   = s.loop;

            s.source.spatialBlend          = s.spatialBlend;
            s.source.outputAudioMixerGroup = s.output;
        }
    }
Exemple #5
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);



        foreach (soundScript s in sounds)
        {
            s.source        = gameObject.AddComponent <AudioSource>();
            s.source.clip   = s.clip;
            s.source.volume = s.volume;
            s.source.pitch  = s.pitch;
            s.source.loop   = s.loop;
        }
    }
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("Only one audioManager can exist");
     }
     instance = this;
 }
 void Start()
 {
     cam        = GameObject.FindGameObjectsWithTag("MainCamera")[0].GetComponent <Camera>();
     manager    = GameObject.Find("Manager");
     aM         = manager.GetComponent <audioManager>();
     startColor = cam.backgroundColor;
     startScore = score;
 }
 private void Awake()
 {
     rb                  = GetComponent <Rigidbody2D>();
     fuelSystem          = GetComponent <FuelSystem>();
     rb.velocity         = new Vector2(startSpeed, 0);
     audioManager        = GameObject.FindGameObjectWithTag("AudioController").transform.GetComponent <audioManager>();
     flameSprite.enabled = false;
 }
 void Awake()
 {
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of SoundEffectsHelper!");
     }
     Instance = this;
     audioSrc = GetComponent <AudioSource>();
 }
 // Start is called before the first frame update
 void Awake()
 {
     instance = this;
     foreach (Sound s in sounds)
     {
         s.source        = gameObject.AddComponent <AudioSource>();
         s.source.clip   = s.clip;
         s.source.volume = s.volume;
     }
 }
Exemple #11
0
 public static audioManager GetInstance()
 {
     if (instance == null)
     {
         myobj      = new GameObject();
         myobj.name = "audioManager";
         instance   = myobj.AddComponent(typeof(audioManager)) as audioManager;
     }
     return(instance);
 }
Exemple #12
0
 void Awake()
 {
     TmpAudios = new List <AudioSource> ();
     myAS      = new AudioSource[2];
     myAS [0]  = gameObject.AddComponent <AudioSource> ();
     myAS [1]  = gameObject.AddComponent <AudioSource> ();
     instance  = this;
     DontDestroyOnLoad(this.gameObject);
     //myAS = gameObject.GetComponents<AudioSource> ();
 }
Exemple #13
0
    public void Sound()
    {
        audioManager audioMan = GameObject.Find("_gm").GetComponent <audioManager> ();

        audioMan.slide  = volSlider;
        volSlider.value = audioMan.masterAudio;
        main.SetActive(false);
        sound.SetActive(true);
        sureQuit.SetActive(false);
        sureRestart.SetActive(false);
    }
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one AudioManager in the scene.");
     }
     else
     {
         instance = this;
     }
 }
Exemple #15
0
    void Awake()
    {
        Instance = this;
        DontDestroyOnLoad(Instance);

        source = this.GetComponent <AudioSource>();

        foreach (Sound soundClip in clips)
        {
            clipDictionary.Add(soundClip.tag, soundClip.clip);
        }
    }
    private void Awake()
    {
        if (audioDaddy == null)
        {
            audioDaddy = this;
        }
        else if (audioDaddy != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Exemple #17
0
    void Awake()
    {
        if(!audioMgr)
            audioMgr = this;

        if (instance != null && instance != this) {
            Destroy(this.gameObject);
            return;
        } else {
            instance = this;
        }
        DontDestroyOnLoad(this.gameObject);
    }
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
    // Use this for initialization
    void Awake()
    {
        if (!instance)
        {
            instance = this;
        }
        else
        {
            Destroy(this);
        }

        masterVolume = defaultMasterVolume;
        BGMVolume    = defaultBGMVolume;
        SFXVolume    = defaultSFXVolume;
    }
 void Start()
 {
     if (!Instance)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
         musicIcon.GetComponent <Toggle> ().isOn = getInstance()._music;
         soundIcon.GetComponent <Toggle> ().isOn = getInstance()._sound;
         musicIcon.GetComponent <Toggle> ().onValueChanged.AddListener(new UnityEngine.Events.UnityAction <bool>(Instance.switchMusic));
         soundIcon.GetComponent <Toggle> ().onValueChanged.AddListener(new UnityEngine.Events.UnityAction <bool>(Instance.switchSound));
     }
     DontDestroyOnLoad(gameObject);
 }
    public void SetSound()
    {
        Toggle ToggleChild = GetComponent <Toggle>();
        int    isTrue      = 1;

        if (ToggleChild.isOn)
        {
            isTrue = 1;
        }
        else
        {
            isTrue = 0;
        }
        PlayerPrefs.SetInt("Sound", isTrue);
        audioManager aManager = GameObject.Find("AudioManager").GetComponent <audioManager>();

        aManager.StartStopMusic();
        Debug.Log(isTrue);
    }
Exemple #22
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        foreach (Sound s in sounds)                                              // At awake load the sounds and its parameters from 'Sound' script
        {
            s.source        = gameObject.AddComponent <AudioSource>();           // Add the sound to the current game object
            s.source.clip   = s.audioClip;                                       // Add the clip
            s.source.volume = s.volume;                                          // Add the volume
            s.source.pitch  = s.pitch;                                           //Add the pitch
        }
    }
Exemple #23
0
    void Awake()
    {
        DontDestroyOnLoad(gameObject);

        player    = GetComponent <playerManager>();
        inventory = GetComponent <inventoryManager>();
        mission   = GetComponent <missionManager>();
        audio     = GetComponent <audioManager>();
        data      = GetComponent <dataManagers>();

        startSequnce = new List <IGameManager>();

        startSequnce.Add(player);
        startSequnce.Add(inventory);
        startSequnce.Add(mission);
        startSequnce.Add(audio);
        startSequnce.Add(data);

        StartCoroutine(startupManagers());
    }
Exemple #24
0
    private void Awake()
    {
        aM = GameObject.FindObjectOfType <audioManager>();

        if (masterVolume)
        {
            slider.value = PlayerPrefs.GetFloat("MasterVolumeValue");
            slider.onValueChanged.AddListener(aM.setMasterVolume);
        }
        else if (musikVolume)
        {
            slider.value = PlayerPrefs.GetFloat("MusikVolumeValue");
            slider.onValueChanged.AddListener(aM.setMusicVolume);
        }
        else if (soundVolume)
        {
            slider.value = PlayerPrefs.GetFloat("SoundVolumeValue");
            slider.onValueChanged.AddListener(aM.setSoundVolume);
        }
    }
Exemple #25
0
    void Awake()   //normalde sahne degistikce o sahnedeki objeler kaybolur. soundManager'ın kaybolmamasi icin kod parcasi
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);  //eger sahnede 2. soundManager bulursa onu sahneden siliyor
            return;
        }
        DontDestroyOnLoad(gameObject);
        foreach (sound s in sounds)  //eklenen seslerin verilerini editorde kullanıcı ayarlamasına sunmak icin gerekli kod
        {
            s.source      = gameObject.AddComponent <AudioSource>();
            s.source.clip = s.clip;

            s.source.pitch  = s.pitch;
            s.source.volume = s.volume;
        }
    }
Exemple #26
0
 void Start()
 {
     instance = this;
 }
Exemple #27
0
 void Awake()
 {
     self = this;
 }
 private void Awake()
 {
     owner = GetComponentInParent <BasicEnemy>();
     _AM   = GetComponent <audioManager>();
 }
 private void Awake()
 {
     anim = GetComponent <Animator>();
     _AM  = GetComponent <audioManager>();
 }
Exemple #30
0
 void Start()
 {
     instance = this;
     source   = GetComponents <AudioSource>();
 }
Exemple #31
0
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
     audioS   = GetComponent <AudioSource>();
 }
Exemple #32
0
 private void Start()
 {
     sounds = this;
 }