示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        AudioMan = GameObject.Find("AudioManager2 Variant").GetComponent <AudioManager2>();
        AudioMan.Play("ambient", 0);

        switch (Mode)
        {
        case 1:
            Temperature.gameObject.SetActive(false);
            Pressure.gameObject.SetActive(false);
            Coal.gameObject.SetActive(false);
            SpeedLimit = Config.SpeedLimitBullet;
            break;

        case 2:
            Temperature.gameObject.SetActive(false);
            Pressure.gameObject.SetActive(false);
            Coal.gameObject.SetActive(false);
            SpeedLimit = Config.SpeedLimitDiesel;
            break;

        case 3:
            SpeedLimit = Config.SpeedLimitSteam;
            break;
        }
        SpeedLimitText.SetText(SpeedLimit + "");
    }
示例#2
0
    private void Awake()
    {
        if (instance == null)
        {                    // if the instance var is null this is first AudioManager
            instance = this; //save this AudioManager in instance
        }


        DontDestroyOnLoad(gameObject); // do not destroy me when a new scene loads

        // get preferences
        mvol = PlayerPrefs.GetFloat("MusicVolume", 0.75f);
        evol = PlayerPrefs.GetFloat("EffectsVolume", 0.75f);

        createAudioSources(sounds, evol);     // create sources for effects
        createAudioSources(playlist, mvol);   // create sources for music
    }
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

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

            s.source.outputAudioMixerGroup = mixerGroup;
        }
    }
 // Use this for initialization
 void Start()
 {
     Instance = this;
     PlayMusic("bgm");
 }
示例#5
0
 private void Awake()
 {
     audioManager    = GetComponent <AudioManager2>();
     particleManager = GetComponent <ParticleManager>();
 }
示例#6
0
 private void Awake()
 {
     current = this;
 }