Beispiel #1
0
 public void SetAmbianceZone(AmbianceZone newZone)
 {
     if (_currentZone.Equals(newZone))
     {
         //nothing happens
     }
     else
     {
         _nextZone  = newZone;
         _switching = true;
     }
 }
Beispiel #2
0
 public AmbianceManager()
 {
     _heartbeat      = 1.0f;
     _currentZone    = AmbianceZone.Outside;
     _nextZone       = _currentZone;
     _switching      = false;
     _audioManager   = YnG.AudioManager;
     _currentPace    = HB_pace.speed1;
     _guideSound     = GuideSound.None;
     _lastTick       = 0;
     _lastGuide      = 0;
     _death          = TypeOfDeath.None;
     _transitionDone = false;
     _muteHeart      = false;
     PlayAmbianceMusic();
     PlayHeartbeat();
 }
Beispiel #3
0
 public AmbianceManager()
 {
     _heartbeat = 1.0f;
     _currentZone = AmbianceZone.Outside;
     _nextZone = _currentZone;
     _switching = false;
     _audioManager = YnG.AudioManager;
     _currentPace = HB_pace.speed1;
     _guideSound = GuideSound.None;
     _lastTick = 0;
     _lastGuide = 0;
     _death = TypeOfDeath.None;
     _transitionDone = false;
     _muteHeart = false;
     PlayAmbianceMusic();
     PlayHeartbeat();
 }
Beispiel #4
0
        public void Update(GameTime gameTime)
        {
            if (!_death.Equals(TypeOfDeath.None))
            {
                if (gameTime.TotalGameTime.TotalMilliseconds - _transitionTimer > 5 * 1000)
                {
                    _transitionDone = true;
                    _death          = TypeOfDeath.None;
                }

                if (gameTime.TotalGameTime.TotalMilliseconds - _lastTick > _heartbeat * 1000)
                {
                    _lastTick = gameTime.TotalGameTime.TotalMilliseconds;
                    if (!_muteHeart)
                    {
                        PlayHeartbeat();
                    }
                }
            }
            else
            {
                _transitionTimer = gameTime.TotalGameTime.TotalMilliseconds;
                if (_guideSound.Equals(GuideSound.None))
                {
                    _lastGuide = gameTime.TotalGameTime.TotalMilliseconds;
                }
                else if (gameTime.TotalGameTime.TotalMilliseconds - _lastGuide > 20 * 1000)
                {
                    _lastGuide = gameTime.TotalGameTime.TotalMilliseconds;
                    PlayGuide();
                }

                if (gameTime.TotalGameTime.TotalMilliseconds - _lastTick > _heartbeat * 1000)
                {
                    _lastTick = gameTime.TotalGameTime.TotalMilliseconds;
                    if (_heartbeat < 0.4f)
                    {
                        _heartbeat = 0.4f;
                    }
                    if (_heartbeat < 0.8f)
                    {
                        _heartbeat += 0.01f;
                    }
                    HB_pace newPace = GetPace();
                    if (_currentPace.Equals(newPace))
                    {
                        _currentPace = newPace;
                    }
                    if (!_muteHeart)
                    {
                        PlayHeartbeat();
                    }
                }
                if (_switching)
                {
                    if (!_nextZone.Equals(_currentZone))
                    {
                        if (_audioManager.MusicVolume > 0f)
                        {
                            _audioManager.MusicVolume -= 0.01f;
                        }
                        if (_audioManager.MusicVolume == 0f)
                        {
                            _currentZone = _nextZone;
                            PlayAmbianceMusic();
                        }
                    }
                    else
                    {
                        float max_volume = 0.5f;
                        if (_currentZone.Equals(AmbianceZone.Stairs) || _currentZone.Equals(AmbianceZone.Room))
                        {
                            max_volume = 0.4f;
                        }
                        if (_audioManager.MusicVolume < max_volume)
                        {
                            _audioManager.MusicVolume += 0.01f;
                        }
                        if (_audioManager.MusicVolume == max_volume)
                        {
                            _switching = false;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public void Update(GameTime gameTime)
        {
            if (!_death.Equals(TypeOfDeath.None))
            {
                if (gameTime.TotalGameTime.TotalMilliseconds - _transitionTimer > 5 * 1000)
                {
                    _transitionDone = true;
                    _death = TypeOfDeath.None;
                }

                if (gameTime.TotalGameTime.TotalMilliseconds - _lastTick > _heartbeat * 1000)
                {
                    _lastTick = gameTime.TotalGameTime.TotalMilliseconds;
                    if (!_muteHeart) { PlayHeartbeat(); }
                }
            }
            else
            {
                _transitionTimer = gameTime.TotalGameTime.TotalMilliseconds;
                if (_guideSound.Equals(GuideSound.None))
                {
                    _lastGuide = gameTime.TotalGameTime.TotalMilliseconds;
                }
                else if (gameTime.TotalGameTime.TotalMilliseconds - _lastGuide > 20 * 1000)
                {
                    _lastGuide = gameTime.TotalGameTime.TotalMilliseconds;
                    PlayGuide();
                }

                if (gameTime.TotalGameTime.TotalMilliseconds - _lastTick > _heartbeat * 1000)
                {
                    _lastTick = gameTime.TotalGameTime.TotalMilliseconds;
                    if (_heartbeat < 0.4f)
                    {
                        _heartbeat = 0.4f;
                    }
                    if (_heartbeat < 0.8f)
                    {
                        _heartbeat += 0.01f;
                    }
                    HB_pace newPace = GetPace();
                    if (_currentPace.Equals(newPace))
                    {
                        _currentPace = newPace;
                    }
                    if (!_muteHeart) { PlayHeartbeat(); }

                }
                if (_switching)
                {
                    if (!_nextZone.Equals(_currentZone))
                    {
                        if (_audioManager.MusicVolume > 0f)
                        {
                            _audioManager.MusicVolume -= 0.01f;
                        }
                        if (_audioManager.MusicVolume == 0f)
                        {
                            _currentZone = _nextZone;
                            PlayAmbianceMusic();
                        }
                    }
                    else
                    {
                        float max_volume = 0.5f;
                        if (_currentZone.Equals(AmbianceZone.Stairs) || _currentZone.Equals(AmbianceZone.Room)) { max_volume = 0.4f; }
                        if (_audioManager.MusicVolume < max_volume)
                        {
                            _audioManager.MusicVolume += 0.01f;
                        }
                        if (_audioManager.MusicVolume == max_volume)
                        {
                            _switching = false;
                        }
                    }
                }
            }
        }
Beispiel #6
0
 public void SetAmbianceZone(AmbianceZone newZone)
 {
     if (_currentZone.Equals(newZone))
     {
         //nothing happens
     }
     else
     {
         _nextZone = newZone;
         _switching = true;
     }
 }