Пример #1
0
        public RaceCompletedMode(CompletionType type)
        {
            _camera               = new FixedChaseCamera(6.3f, 2.3f);
            _camera.FieldOfView   = MathHelper.ToRadians(55.55f);
            _camera.RotationSpeed = 0.8f;
            _camera.MinHeight     = 10;

            switch (type)
            {
            case CompletionType.Opponents:
                MessageRenderer.Instance.PostHeaderMessage("Every opponent wasted!!", 10);
                MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                SoundCache.Play(SoundIds.RaceCompleted, null, false);
                SoundCache.Play(SoundIds.Clapping, null, false);
                break;

            case CompletionType.Checkpoints:
                MessageRenderer.Instance.PostHeaderMessage("All checkpoints passed!!", 10);
                MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                SoundCache.Play(SoundIds.RaceCompleted, null, false);
                SoundCache.Play(SoundIds.Clapping, null, false);
                break;

            case CompletionType.Peds:
                MessageRenderer.Instance.PostHeaderMessage("Every pedestrian murdered!!", 10);
                MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                SoundCache.Play(SoundIds.RaceCompleted, null, false);
                SoundCache.Play(SoundIds.Clapping, null, false);
                break;

            case CompletionType.TimeUp:
                MessageRenderer.Instance.PostMainMessage("timeup.pix", 8, 0.7f, 0.003f, 1.4f);
                SoundCache.Play(SoundIds.OutOfTime, null, false);
                break;
            }

            _camera.ResetRotation();
            _camera.RotateTo(MathHelper.Pi * 2);
            Engine.Camera = _camera;
        }
Пример #2
0
 public virtual void Update()
 {
     if (_waitingForOutAnimation)
     {
         if (_outAnimation == null || !_outAnimation.IsPlaying)
         {
             _waitingForOutAnimation = false;
             OnOutAnimationFinished();
             return;
         }
     }
     else
     {
         if (Engine.Input.WasPressed(Keys.Escape) && Parent != null)
         {
             if (SoundCache.IsInitialized)
             {
                 SoundCache.Play(SoundIds.UI_Esc, null, false);
             }
             ReturnToParent();
         }
         if (Engine.Input.WasPressed(Keys.Down))
         {
             if (_selectedOption < _options.Count - 1)
             {
                 _selectedOption++;
             }
             else
             {
                 _selectedOption = 0;
             }
             if (SoundCache.IsInitialized)
             {
                 SoundCache.Play(SoundIds.UI_UpDown, null, false);
             }
         }
         else if (Engine.Input.WasPressed(Keys.Up))
         {
             if (_selectedOption > 0)
             {
                 _selectedOption--;
             }
             else
             {
                 _selectedOption = _options.Count - 1;
             }
             if (SoundCache.IsInitialized)
             {
                 SoundCache.Play(SoundIds.UI_UpDown, null, false);
             }
         }
         else if (Engine.Input.WasPressed(Keys.Enter))
         {
             if (_options.Count == 0 || _options[_selectedOption].CanBeSelected)
             {
                 if (SoundCache.IsInitialized)
                 {
                     SoundCache.Play(SoundIds.UI_Ok, null, false);
                 }
                 PlayOutAnimation();
             }
         }
     }
     if (_inAnimation != null)
     {
         _inAnimation.Update();
     }
     if (_outAnimation != null)
     {
         _outAnimation.Update();
     }
 }