Exemple #1
0
        /// <summary>
        /// Moves Smiley to a new area and starts the loading effect.
        /// </summary>
        /// <param name="destinationX"></param>
        /// <param name="destinationY"></param>
        /// <param name="destinationArea"></param>
        public void ChangeArea(int destinationX, int destinationY, Level destinationLevel)
        {
            _doneZoomingIn    = false;
            _destinationX     = destinationX;
            _destinationY     = destinationY;
            _destinationLevel = destinationLevel;

            _state = AreaChangeState.In;
            _loadingEffectScale = 3f;
            SMH.Sound.PlaySound(Sound.AreaChangeUp);
            SMH.Sound.StopAllLoopedSounds();
        }
Exemple #2
0
        /// <summary>
        /// Updates the area changer.
        /// </summary>
        /// <param name="dt"></param>
        public void Update(float dt)
        {
            //Circle zooming in
            if (_state == AreaChangeState.In)
            {
                if (_doneZoomingIn)
                {
                    _loadingEffectScale = 0f;

                    //Relocate Smiley
                    if (_destinationLevel == SMH.SaveManager.CurrentSave.Level)
                    {
                        //Move smiley to a new location in the same area
                        SMH.Player.MoveTo(_destinationX, _destinationY);
                        SMH.Environment.Update(0f);
                        SMH.EnemyManager.Update(0f);
                        SMH.LootManager.Update(0f);
                        SMH.ProjectileManager.Update(0f);
                    }
                    else
                    {
                        SMH.Environment.LoadLevel(_destinationLevel, SMH.SaveManager.CurrentSave.Level, true);
                        _zoneTextAlpha = 255f;
                    }
                    _state = AreaChangeState.Out;
                }
                else
                {
                    _loadingEffectScale -= 3f * dt;
                }

                //When done zooming in don't actually move Smiley until the next frame so
                //that it draws the circle completely zoomed in while the level is loading
                if (_loadingEffectScale < 0.00001 && !_doneZoomingIn)
                {
                    _doneZoomingIn = true;
                    SMH.Sound.PlaySound(Sound.AreaChangeDown);
                }
            }
            else if (_state == AreaChangeState.Out)
            {
                //Circle zooming out
                _loadingEffectScale += 3f * dt;
                if (_loadingEffectScale > 3.0)
                {
                    _loadingEffectScale = 3f;
                    _state = AreaChangeState.Inactive;
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// Constructs a new AreaChanger.
 /// </summary>
 public AreaChanger()
 {
     _state           = AreaChangeState.Inactive;
     _timeLevelLoaded = SMH.Now + 2.5f;
 }