예제 #1
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Sonos.PlayAt(sfx, transform);
     }
     if (Input.GetMouseButtonDown(1))
     {
         Sonos.Play(sfx);
     }
     if (Input.GetMouseButtonDown(2))
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }
     if (Input.mouseScrollDelta.y > 0f)    // forward
     //Sonos.VolumeMaster += 0.1f;
     //Sonos.instance.Volume[(int)AudioType.Music] += 0.1f;
     {
         Sonos.ChangeVolume(AudioType.Effect, 0.1f);
     }
     else if (Input.mouseScrollDelta.y < 0f)       // backwards
     //Sonos.VolumeMaster -= 0.1f;
     //Sonos.instance.Volume[(int)AudioType.Music] -= 0.1f;
     {
         Sonos.ChangeVolume(AudioType.Effect, -0.1f);
     }
 }
예제 #2
0
    void Awake()
    {
        //Singleton Pattern
        DontDestroyOnLoad(gameObject);

        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }
        //Volume Types setup as 1f each
        _volumeMaster = 1f;
        foreach (var aType in (AudioType[])Enum.GetValues(typeof(AudioType)))
        {
            Volume.Add(1f);
        }
        //Set up the initial pool
        for (int i = 0; i < playerPoolPreferredSize; i++)
        {
            AddPlayerToPool();
        }
        //Subscribe to Scene management event
        SceneManager.sceneLoaded += OnSceneLoaded;
    }
예제 #3
0
        public async void Request(SpeechRecognitionResult Rule)
        {
            switch (Rule.Constraint.Tag)
            {
            case "TurnOnSonos":
                Sonos.Play();
                break;

            case "TurnOffSonos":
                Sonos.Pause();
                break;

            case "NextSong":
                Sonos.Next();
                break;

            case "PreviousSong":
                Sonos.Previous();
                break;

            case "SoundUp":
                int volume = await Sonos.GetVolume() + 10;

                if (volume > 100)
                {
                    volume = 100;
                }
                Sonos.SetVolume(volume);
                break;

            case "SoundDown":
                int volum = await Sonos.GetVolume() - 10;

                if (volum < 0)
                {
                    volum = 0;
                }
                Sonos.SetVolume(volum);
                break;

            case "TurnOffLight":
                Hue.TurnOffLights();
                break;

            case "TurnOnLight":
                Hue.TurnOnLights();
                break;

            case "Fort":
                Sonos.SetVolume(100);
                break;
            }
        }
예제 #4
0
 private void OnEnable()
 {
     volumeMaster.value = Sonos.VolumeMaster;
     //Debug.Log("volumeMaster.value: "+volumeMaster.value);
     volumeMaster.onValueChanged.AddListener(delegate { volumeMaster_onValueChanged(); });
     volumeBGM.value = Sonos.GetVolume(AudioType.Music);
     //Debug.Log("volumeBGM.value: "+volumeBGM.value);
     volumeBGM.onValueChanged.AddListener(delegate { volumeBGM_onValueChanged(); });
     volumeSFX.value = Sonos.GetVolume(AudioType.Effect);
     //Debug.Log("volumeSFX.value: "+volumeSFX.value);
     volumeSFX.onValueChanged.AddListener(delegate { volumeSFX_onValueChanged(); });
 }
예제 #5
0
 void Start()
 {
     Sonos.Play(bgm);
     Sonos.PlayAt(missileLoop, transform);
     Sonos.VolumeMaster = 0.5f;
 }
예제 #6
0
 public void volumeSFX_onValueChanged()
 {
     Sonos.SetVolume(AudioType.Effect, volumeSFX.value);
 }
예제 #7
0
 public void volumeBGM_onValueChanged()
 {
     Sonos.SetVolume(AudioType.Music, volumeBGM.value);
 }
예제 #8
0
 public void Unpack(Sonos _audioManager)
 {
     audioManager = _audioManager;
     audioManager.OnVolumeChanged += AudioSetVolume;
 }