示例#1
0
    private void Update()
    {
        if (isDay && DayCycleManager.Instance.Cycle % 1 > 0.25f && DayCycleManager.Instance.Cycle % 1 < 0.75f)
        {
            audioBox.StopLoop(dayAmbianceSound);
            audioBox.PlayLoop(nightAmbianceSound);

            isDay = false;
        }
        else if (!isDay && DayCycleManager.Instance.Cycle % 1 > 0.75f)
        {
            audioBox.StopLoop(nightAmbianceSound);
            audioBox.PlayLoop(dayAmbianceSound);

            isDay = true;
        }
    }
示例#2
0
    private void MeteoChanged(bool value)
    {
        float cycle = DayCycleManager.Instance.Cycle;

        if (IsRain)
        {
            if (SeasonManager.Instance.IsWinter())
            {
                SnowStormPS.gameObject.SetActive(value);
                if (value)
                {
                    audioBox.PlayLoop(SoundLoop.AmbianceSnow);
                }
                else
                {
                    audioBox.StopLoop(SoundLoop.AmbianceSnow);
                }
            }
            else
            {
                RainStormPS.gameObject.SetActive(value);
                if (value)
                {
                    audioBox.PlayLoop(SoundLoop.AmbianceRain);
                }
                else
                {
                    audioBox.StopLoop(SoundLoop.AmbianceRain);
                }
            }
        }
        else
        {
            if (SeasonManager.Instance.IsWinter())
            {
                if (SnowStormPS.gameObject.activeSelf && SnowStormPS.isPlaying)
                {
                    SnowStormPS.gameObject.SetActive(value);
                    if (value)
                    {
                        audioBox.PlayLoop(SoundLoop.AmbianceSnow);
                    }
                    else
                    {
                        audioBox.StopLoop(SoundLoop.AmbianceSnow);
                    }
                }
            }
            else
            {
                if (SnowStormPS.gameObject.activeSelf && RainStormPS.isPlaying)
                {
                    RainStormPS.gameObject.SetActive(value);
                    if (value)
                    {
                        audioBox.PlayLoop(SoundLoop.AmbianceRain);
                    }
                    else
                    {
                        audioBox.StopLoop(SoundLoop.AmbianceRain);
                    }
                }
            }
        }
    }
示例#3
0
 private void Start()
 {
     audioBox = GetComponent <AudioBox>();
     audioBox.PlayLoop(dayAmbianceSound);
 }