internal void Update(DeltaGameTime time) { for (int i = 0; i < 4; i++) { _gamePads[i] = Microsoft.Xna.Framework.Input.GamePad.GetState((PlayerIndex)i); _chatPads[i] = Microsoft.Xna.Framework.Input.Keyboard.GetState((PlayerIndex)i); } #if WINDOWS _mouseState = Microsoft.Xna.Framework.Input.Mouse.GetState(); Keyboard.Update(time, ref _chatPads[0]); Mouse.Update(time, ref _mouseState); #endif #if XBOX for (int i = 0; i < 4; i++) { if (PlayerInput[i].ControlInput != ControlInput.KeyboardMouse) PlayerInput[i].UpdatePadState(totalSeconds, ref keyboards[(int)this.PlayerInput[i].ControlInput]); } #endif #if WINDOWS if (Mouse.PositionDelta != Vector2.Zero) G.UI.MouseMove(); if (Mouse.LeftButton.IsPressed || Mouse.RightButton.IsPressed || Mouse.MiddleButton.IsPressed || Mouse.XButton1.IsPressed || Mouse.XButton2.IsPressed) G.UI.MouseDown(); if (Mouse.LeftButton.IsReleased || Mouse.RightButton.IsReleased || Mouse.MiddleButton.IsReleased || Mouse.XButton1.IsReleased || Mouse.XButton2.IsReleased) G.UI.MouseUp(); Keyboard.KeyDown(G.UI._keyDown); Keyboard.KeyPressed(G.UI._keyPress); Keyboard.KeyUp(G.UI._keyUp); #endif }
protected internal override void HeavyUpdate(DeltaGameTime time) { UpdateTextSize(); base.HeavyUpdate(time); UpdateRenderText(); UpdateTextPosition(); }
protected override void LightUpdate(DeltaGameTime time) { base.LightUpdate(time); _sprite.Position = WrappedBody.SimulationPosition; _sprite.InternalUpdate(time); Depth = Position.Y; if (G.Input.Keyboard.IsDown(Keys.Q)) Rotation = (Rotation + (0.5f)); else if (G.Input.Keyboard.IsDown(Keys.E)) Rotation = (Rotation - (0.5f)); Rotation = Rotation.Wrap(0, 360); Vector2 direction = G.Input.ArrowDirection; _spriteController.Walk(direction); Velocity = ((G.Input.Keyboard.IsDown(Keys.LeftShift)) ? direction * 2.5f : direction) * SPEED; Position += Velocity * (float)time.ElapsedSeconds; if (G.Input.Keyboard.IsPressed(Keys.Tab)) SwitchBody(); // if boosting leave a motion trail //if (G.World.SecondsPast(_trailTime + _trailInterval) && G.Input.Keyboard.IsDown(Keys.LeftShift)) //{ // Visuals.CreateTrail(@"Graphics\SpriteSheets\16x16", _spriteController.ToString(), Position); // _trailTime = (float)time.TotalSeconds; //} }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { if (LowerBackground == null || UpperBackground == null) return; Rectangle sizeRect = new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y); spriteBatch.DrawTiledArea(LowerBackground, lowerOffset, LowerBackground.Bounds, sizeRect); spriteBatch.DrawTiledArea(UpperBackground, upperOffset, UpperBackground.Bounds, sizeRect); base.Draw(time, spriteBatch); }
public bool Update(DeltaGameTime time) { if (_cue.IsStopped || _cue.IsDisposed) { return(false); } return(true); }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { //spriteBatch.DrawRectangleOutline(new Rectangle((int)_leftPosition.X + 5, (int)(_leftPosition.Y + 2 + (1 - _leftFillPercent) * 60.0f), 8, (int)(60.0f * _leftFillPercent)), LeftBarColor.SetAlpha(Alpha), true); //spriteBatch.DrawRectangleOutline(new Rectangle((int)_rightPosition.X + 5, (int)(_rightPosition.Y + 2 + (1 - _rightFillPercent) * 60.0f), 8, (int)(60.0f * _rightFillPercent)), RightBarColor.SetAlpha(Alpha), true); spriteBatch.Draw(_healthBar, _leftPosition, Color.White.SetAlpha(Alpha)); spriteBatch.Draw(_ammoBar, _rightPosition, Color.White.SetAlpha(Alpha)); spriteBatch.DrawString(G.Font, (int)(_leftFillPercent * 100.0f) + "%", new Vector2(_leftPosition.X + 10, _leftPosition.Y + 2 + 30), Color.White.SetAlpha(Alpha), TextAlignment.Center); spriteBatch.DrawString(G.Font, (int)(_rightFillPercent * 100.0f) + "%", new Vector2(_rightPosition.X + 10, _rightPosition.Y + 2 + 30), Color.White.SetAlpha(Alpha), TextAlignment.Center); }
public void InternalDraw(DeltaGameTime time, SpriteBatch spriteBatch) { if (CanDraw()) { OnBeginDraw(time, spriteBatch); Draw(time, spriteBatch); OnEndDraw(time, spriteBatch); } }
protected override void LightUpdate(DeltaGameTime time) { if (_lucas == null) _lucas = TransformableEntity.Get("Lucas") as Lucas; for (int i = 0; i < NUM_PARTICLES; i++) { _particles[i].Velocity = -GRAVITY * (M1 * M2 / MathExtensions.Square(Vector2.Distance(_particles[i].Position, _lucas.Position))) * (_particles[i].Position - _lucas.Position); _particles[i].Position += _particles[i].Velocity * (float)time.ElapsedSeconds; } }
protected override void LightUpdate(DeltaGameTime time) { _timer += time.ElapsedSeconds; if (_timer >= 1) { _fps = _frameCounter; _previousManagedMemory = _managedMemory; _managedMemory = GC.GetTotalMemory(false); _deltaManagedMemory = _managedMemory - _previousManagedMemory; _frameCounter = 0; _timer = 0; } Text.Clear(); Text.Append("FPS: "); Text.Concat(_fps); Text.AppendLine(); Text.Append("MEM: "); if (_managedMemory < 1024) { Text.Concat(_managedMemory); Text.Append(" B"); } else if (_managedMemory < (1024 * 1024)) { Text.Concat((float)(_managedMemory / 1024f), 2); Text.Append(" kB"); } else if (_managedMemory < (1024 * 1024 * 1024)) { Text.Concat((float)(_managedMemory / 1024f / 1024f), 2); Text.Append(" mB"); } if (_deltaManagedMemory > 0) { if (_deltaManagedMemory < 1024) { Text.Append(" (+"); Text.Concat(_deltaManagedMemory); Text.Append(" B/sec)"); } else if (_deltaManagedMemory < (1024 * 1024)) { Text.Append(" (+"); Text.Concat((float)(_deltaManagedMemory / 1024f), 2); Text.Append(" kB/sec)"); } else if (_deltaManagedMemory < (1024 * 1024 * 1024)) { Text.Append(" (+"); Text.Concat((float)(_deltaManagedMemory / 1024f / 1024f), 2); Text.Append(" mB/sec)"); } } Invalidate(); }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { //spriteBatch.End(); //G.SimpleEffect.SetTechnique(Graphics.Effects.SimpleEffect.Technique.Flicker); //G.SimpleEffect.FlickerRate = 50; //spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, G.SimpleEffect, World.Instance.Camera.View); spriteBatch.Draw(_texture, Position, new Rectangle(0, 0, _texture.Width, _texture.Height), Color.White * Alpha, Rotation, new Vector2(_texture.Width / 2, _texture.Height / 2), Scale, SpriteEffects.None, 0f); //spriteBatch.End(); //spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, World.Instance.Camera.View); base.Draw(time, spriteBatch); }
internal void SetState(bool value, DeltaGameTime time) { WasDown = IsDown; IsDown = value; if (IsDown && WasDown) DownDuration += time.ElapsedSeconds; else DownDuration = 0; if (!IsDown && !WasDown) UpDuration += time.ElapsedSeconds; else UpDuration = 0; }
internal void Update(DeltaGameTime time, ref MouseState mouseState) { MouseState = mouseState; PositionOld = Position; Position = new Vector2(mouseState.X, mouseState.Y); PositionDelta = Position - PositionOld; ScrollWheelDelta = mouseState.ScrollWheelValue - ScrollWheelValue; ScrollWheelValue = mouseState.ScrollWheelValue; LeftButton.SetState(mouseState.LeftButton == ButtonState.Pressed, time); RightButton.SetState(mouseState.RightButton == ButtonState.Pressed, time); MiddleButton.SetState(mouseState.MiddleButton== ButtonState.Pressed, time); XButton1.SetState(mouseState.XButton1 == ButtonState.Pressed, time); XButton2.SetState(mouseState.XButton2 == ButtonState.Pressed, time); }
protected override void LightUpdate(DeltaGameTime time) { if (!IsOrbiting) return; _rotation = MathHelper.WrapAngle(_rotation + 0.005f); Vector2 newPosition = Vector2.Zero; if (_orbiting == null) newPosition += _center; else newPosition += _orbiting.Position; newPosition.X = (float)Math.Cos(_rotation) * OrbitLength; newPosition.Y = (float)Math.Sin(_rotation) * OrbitLength; Position = newPosition; base.LightUpdate(time); }
public void Update(DeltaGameTime time) { // don't complain if the audio engine isn't ready yet if (_audioEngine == null) { return; } _audioEngine.Update(); foreach (ISound sound in _sounds) { if (!sound.Update(time)) { _soundsToRemove.Add(sound); } } foreach (ISound sound in _soundsToRemove) { sound.Recycle(); _sounds.Remove(sound); } _soundsToRemove.Clear(); for (int i = 0; i < (int)AudioChannel.Count; i++) { if (_channelFading[i]) { if (_channelFadeDuration[i] < _channelFadeElapsed[i]) { _channelVolume[i] = MathHelper.SmoothStep(_channelVolume[i], _channelGoalVolume[i], _channelFadeElapsed[i] / _channelFadeDuration[i]); _channelCategory[i].SetVolume(_channelVolume[i]); _channelFadeElapsed[i] = time.ElapsedSeconds; } else { _channelVolume[i] = _channelGoalVolume[i]; _channelCategory[i].SetVolume(_channelVolume[i]); _channelGoalVolume[i] = 0f; _channelFadeElapsed[i] = 0f; _channelFadeDuration[i] = 0f; _channelFading[i] = false; } } } }
protected override void LightUpdate(DeltaGameTime time) { Size = new Vector2((int)G.ScreenArea.Width, (int)G.ScreenArea.Height); scroll1 += time.ElapsedSeconds * 16.0f; while (scroll1 > 32.0f) scroll1 -= 32.0f; scroll2 += time.ElapsedSeconds * 20.0f; while (scroll2 > 32.0f) scroll2 -= 32.0f; int xOffset = 32 - (int)scroll2; int yOffset = (int)scroll2; lowerOffset = new Vector2(-32 + xOffset, -32 + yOffset); xOffset = (int)scroll1; yOffset = (int)scroll1; upperOffset = new Vector2(-32 + xOffset, -32 + yOffset); base.LightUpdate(time); }
/// <summary> /// Called when the <see cref="Entity"/> is starting to update. /// </summary> /// <param name="time">time</param> protected virtual void OnBeginUpdate(DeltaGameTime time) { }
public virtual void InternalDraw(DeltaGameTime time, SpriteBatch spriteBatch) { if (CanDraw()) { OnBeginDraw(time, spriteBatch); if (G.CurrentPostEffects == PostEffects) Draw(time, spriteBatch); OnEndDraw(time, spriteBatch); } }
/// <summary> /// Updates the <see cref="Entity"/>. Override this method to add custom update logic which is too expensive to execute every frame. /// </summary> /// <param name="time">time</param> protected internal virtual void HeavyUpdate(DeltaGameTime time) { }
/// <summary> /// Updates the <see cref="Entity"/>. Override this method to add custom update logic which is executed every frame. /// </summary> /// <param name="time">time</param> protected virtual void LightUpdate(DeltaGameTime time) { }
public virtual void InternalUpdate(DeltaGameTime time) { if (_flaggedForRemoval) RemoveImmediately(); InternalInitliaze(); InternalLoadContent(); if (CanUpdate()) { OnBeginUpdate(time); LightUpdate(time); if (NeedsHeavyUpdate) { NeedsHeavyUpdate = false; HeavyUpdate(time); } OnEndUpdate(time); } }
protected override void LightUpdate(DeltaGameTime time) { if (!IsVisible) { return; } _sprite.InternalUpdate(time); if (_time == 0f) { _time = time.TotalSeconds; } if (_storeText[_currString].Count() > _indexText) { if (G.Input.Keyboard.IsDown(Keys.Space)) { _timeApart = _fastSpeed; } else { _timeApart = _normalSpeed; } if ((time.TotalSeconds - _time) > _timeApart) { _printText = string.Concat(_printText, (_storeText[_currString])[_indexText]); _indexText++; _time = time.TotalSeconds; } } if ((_storeText[_currString]).Count() == _indexText) { if (G.Input.Keyboard[Keys.Space].IsDown && G.Input.Keyboard[Keys.Space].DownDuration < 0.01f) { if (_currString < (_storeText.Count() - 1)) { _timeCD = 0f; _indexText = 0; _printText = string.Empty; _currString++; _sprite.Play("Active"); } else { _timeCD = 0f; _currString = 0; _indexText = 0; _printText = string.Empty; _sprite.Play("Active"); IsVisible = false; } } else { if (_timeCD == 0f) { _timeCD = time.TotalSeconds; } if ((time.TotalSeconds - _timeCD) > _idleCountdown) { _sprite.Play("Idle", AnimationOptions.Looped); } } } //oldState = Keyboard.GetState(); /* if (Conversation != null) { if (newState.IsKeyDown(Keys.Up) && lastState.IsKeyUp(Keys.Up)) { currentHandler--; if (currentHandler < 0) { currentHandler = Conversation.Handlers.Count - 1; } } if (newState.IsKeyDown(Keys.Down) && lastState.IsKeyUp(Keys.Down)) { currentHandler = (currentHandler + 1) % Conversation.Handlers.Count; } } * */ base.LightUpdate(time); }
protected override void LightUpdate(DeltaGameTime time) { Velocity.X = MathHelper.SmoothStep(Velocity.X, 0, _decel); Velocity.Y = MathHelper.SmoothStep(Velocity.Y, 0, _decel); if (G.Input.Keyboard.IsDown(Keys.Up)) { float speedx = (float)Math.Cos(_rotation) * _speed; float speedy = (float)Math.Sin(_rotation) * _speed; Velocity.Y = MathHelper.SmoothStep(Velocity.Y, speedy, _accel); Velocity.X = MathHelper.SmoothStep(Velocity.X, speedx, _accel); } if (G.Input.Keyboard.IsDown(Keys.Down)) { float speedx = (float)Math.Cos(_rotation) * -_speed; float speedy = (float)Math.Sin(_rotation) * -_speed; Velocity.Y = MathHelper.SmoothStep(Velocity.Y, speedy, _accel); Velocity.X = MathHelper.SmoothStep(Velocity.X, speedx, _accel); } if (G.Input.Keyboard.IsDown(Keys.Left)) { _rotation = MathHelper.WrapAngle(_rotation - 0.08f); } if (G.Input.Keyboard.IsDown(Keys.Right)) { _rotation = MathHelper.WrapAngle(_rotation + 0.08f); } Position += Velocity * G.World.Time.ElapsedSeconds; if (G.Input.Keyboard.IsPressed(Keys.Space) && !_isBoosting && G.World.Camera.Scale == NORMAL_ZOOM) { G.World.Camera.Flash(Color.White); G.World.Camera.Shake(10f, 0.5f, ShakeAxis.X | ShakeAxis.Y); G.Audio.PlaySound("SFX_LargeExplosion"); G.Audio.FadeChannelByAmount(AudioChannel.Music, 0.5f, 0.4f); G.Audio.SetSoundVolume("SFX_Ambiance_1", 1f); G.World.Camera.ZoomByAmount(BOOST_ZOOM - NORMAL_ZOOM); _isBoosting = true; } if (_isBoosting) { HUD.Alpha = MathHelper.SmoothStep(1f, 0f, (NORMAL_ZOOM - G.World.Camera.Scale) / Math.Abs(BOOST_ZOOM - NORMAL_ZOOM)); _boostElapsed += G.World.Time.ElapsedSeconds; _speed = BOOST_SPEED; if (_boostElapsed > _boostDuration && !G.Input.Keyboard.IsDown(Keys.Space)) { _speed = NORMAL_SPEED; _boostElapsed = 0; _isBoosting = false; G.World.Camera.ZoomByAmount(NORMAL_ZOOM - BOOST_ZOOM); G.Audio.FadeChannelIn(AudioChannel.Music, 0.5f); G.Audio.SetSoundVolume("SFX_Ambiance_1", 0.8f); } } else if (!_isBoosting && HUD.Alpha < 1) { HUD.Alpha = MathHelper.SmoothStep(0f, 1f, 1 - (NORMAL_ZOOM - G.World.Camera.Scale) / Math.Abs(BOOST_ZOOM - NORMAL_ZOOM)); } else { if (G.Input.Keyboard.IsDown(Keys.LeftControl) && !_isLeftCooldown) // charging { G.Audio.PlaySound("SFX_Charge", false); G.Audio.SetSoundPitch("SFX_Charge", HUD.LeftFillPercent); HUD.LeftFillPercent = MathHelper.Lerp(HUD.LeftFillPercent, 1, 0.01f); } else if (G.Input.Keyboard.IsPressed(Keys.LeftControl)) // fired { G.Audio.StopSound("SFX_Charge"); G.Audio.PlaySound("SFX_Laser", true); G.Audio.SetSoundVolume("SFX_Laser", HUD.LeftFillPercent); _isLeftCooldown = true; } else if (!G.Input.Keyboard.IsDown(Keys.LeftControl)) // cooldown { HUD.LeftFillPercent = MathHelper.SmoothStep(HUD.LeftFillPercent, 0, 0.1f); if (HUD.LeftFillPercent < 0.3) _isLeftCooldown = false; } if (G.Input.Keyboard.IsDown(Keys.RightControl) && !_isRightCooldown) // charging { G.Audio.PlaySound("SFX_Charge", false); G.Audio.SetSoundPitch("SFX_Charge", HUD.RightFillPercent); HUD.RightFillPercent = MathHelper.Lerp(HUD.RightFillPercent, 1, 0.01f); } else if (G.Input.Keyboard.IsReleased(Keys.RightControl)) // fired { G.Audio.StopSound("SFX_Charge"); G.Audio.PlaySound("SFX_Laser", true); G.Audio.SetSoundVolume("SFX_Laser", HUD.RightFillPercent); _isRightCooldown = true; } else if (!G.Input.Keyboard.IsDown(Keys.RightControl)) // cooldown { HUD.RightFillPercent = MathHelper.SmoothStep(HUD.RightFillPercent, 0, 0.1f); if (HUD.RightFillPercent < 0.3) _isRightCooldown = false; } } }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { Vector2 offset = new Vector2(_sheet.Width / 2, _sheet.Height / 2); spriteBatch.Draw(_sheet, Position, null, Color.White, _rotation + MathHelper.Pi * 0.5f, offset, 1, SpriteEffects.None, 0); Vector2 direction = Velocity; direction.Normalize(); if (_isLeftCooldown) spriteBatch.DrawLine(Position, _rotation, 500, Color.DarkGreen.SetAlpha(HUD.LeftFillPercent), HUD.LeftFillPercent * 20); else if (_isRightCooldown) spriteBatch.DrawLine(Position, _rotation, 500, Color.DarkGreen.SetAlpha(HUD.RightFillPercent), HUD.RightFillPercent * 20); }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { spriteBatch.Draw(_texture, Position, Color.White); base.Draw(time, spriteBatch); }
/// <summary> /// Draws the <see cref="Entity"/>. Override to add custom draw logic which is executed every frame. /// </summary> /// <param name="time">time</param> /// <param name="spriteBatch">spriteBatch</param> protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { base.Draw(time, spriteBatch); //if (IsOutlined) //{ // spriteBatch.End(); // G.SimpleEffect.SetTechnique(Effects.SimpleEffect.Technique.FillColor); // G.SimpleEffect.Color = OutlineColor; // spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, G.SimpleEffect, G.World.Camera.View); // spriteBatch.Draw(_spriteSheet.Texture, RenderPosition - Vector2.UnitY, _sourceRectangle, Tint, Rotation, RenderOrigin, Scale, SpriteEffects, 0); // spriteBatch.Draw(_spriteSheet.Texture, RenderPosition + Vector2.UnitX, _sourceRectangle, Tint, Rotation, RenderOrigin, Scale, SpriteEffects, 0); // spriteBatch.Draw(_spriteSheet.Texture, RenderPosition + Vector2.UnitY, _sourceRectangle, Tint, Rotation, RenderOrigin, Scale, SpriteEffects, 0); // spriteBatch.Draw(_spriteSheet.Texture, RenderPosition - Vector2.UnitX, _sourceRectangle, Tint, Rotation, RenderOrigin, Scale, SpriteEffects, 0); // spriteBatch.End(); // spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, G.World.Camera.View); //} spriteBatch.DrawTransformableEntity(this, _spriteSheet.Texture, _sourceRectangle, _spriteEffects, 0); }
protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch) { // Draw BG BOX G.SpriteBatch.End(); G.SpriteBatch.Begin(); G.SpriteBatch.DrawRectangle(_backGroundArea, _backGroundColor); if (_conversation == null) { return; } // Draw Title G.SpriteBatch.DrawString(_textFont, _conversation.Title, Position + _titleOffset, _conversation.TitleColor); // Draw Text G.SpriteBatch.DrawString(_textFont, _printText, Position + _textOffset, _conversation.TextColor); // Draw Animation G.SpriteBatch.End(); G.SpriteBatch.Begin(SpriteSortMode.Immediate,BlendState.AlphaBlend,SamplerState.PointClamp,DepthStencilState.Default, RasterizerState.CullNone); _sprite.InternalDraw(time, G.SpriteBatch); G.SpriteBatch.End(); G.SpriteBatch.Begin(); }
/// <summary> /// Called when the <see cref="Entity"/> is finished updating. /// </summary> /// <param name="time">time</param> protected virtual void OnEndUpdate(DeltaGameTime time) { }
public bool Update(DeltaGameTime time) { if (_cue.IsStopped || _cue.IsDisposed) { return false; } return true; }
/// <summary> /// Called when the <see cref="Entity"/> is finished drawing. /// </summary> /// <param name="time">time</param> /// <param name="spriteBatch">spriteBatch</param> protected virtual void OnEndDraw(DeltaGameTime time, SpriteBatch spriteBatch) { }
internal virtual void Update(DeltaGameTime time) { // are we following the tracking entity, the player, or the goal position? if (IsTracking && Mode != CameraMode.FollowPlayer) { _position.X = MathHelper.SmoothStep(_position.X, Tracking.Position.X, _translationRate); _position.Y = MathHelper.SmoothStep(_position.Y, Tracking.Position.Y, _translationRate); } else if (!IsTracking && _moveDuration > 0.0f) { if (_moveElapsed > _moveDuration) { _moveElapsed = 0; _moveDuration = 0; _desiredPosition = Vector2.Zero; } else { _moveElapsed += time.ElapsedSeconds; float amount = MathHelper.Clamp(_moveElapsed / _moveDuration, 0.0f, 1.0f); _position.X = MathHelper.SmoothStep(_position.X, _desiredPosition.X, amount); _position.Y = MathHelper.SmoothStep(_position.Y, _desiredPosition.Y, amount); } } UpdateShake(time.ElapsedSeconds); UpdateScale(time.ElapsedSeconds); if (BoundsEnabled) { _position.X = MathHelper.Clamp(_position.X + _shakeOffset.X, BoundedArea.Left + ViewingArea.Width / 2, BoundedArea.Right - ViewingArea.Width / 2); _position.Y = MathHelper.Clamp(_position.Y + _shakeOffset.Y, BoundedArea.Top + ViewingArea.Height / 2, BoundedArea.Bottom - ViewingArea.Height / 2); } if (_flashDuration > _flashElapsed) { _flashElapsed += time.ElapsedSeconds; } else { _flashDuration = 0; _flashElapsed = 0; } UpdateView(); UpdateProjection(); UpdateWorld(); }
public void Update(DeltaGameTime time) { // don't complain if the audio engine isn't ready yet if (_audioEngine == null) return; _audioEngine.Update(); foreach (ISound sound in _sounds) { if (!sound.Update(time)) { _soundsToRemove.Add(sound); } } foreach (ISound sound in _soundsToRemove) { sound.Recycle(); _sounds.Remove(sound); } _soundsToRemove.Clear(); for (int i = 0; i < (int)AudioChannel.Count; i++) { if (_channelFading[i]) { if (_channelFadeDuration[i] < _channelFadeElapsed[i]) { _channelVolume[i] = MathHelper.SmoothStep(_channelVolume[i], _channelGoalVolume[i], _channelFadeElapsed[i] / _channelFadeDuration[i]); _channelCategory[i].SetVolume(_channelVolume[i]); _channelFadeElapsed[i] = time.ElapsedSeconds; } else { _channelVolume[i] = _channelGoalVolume[i]; _channelCategory[i].SetVolume(_channelVolume[i]); _channelGoalVolume[i] = 0f; _channelFadeElapsed[i] = 0f; _channelFadeDuration[i] = 0f; _channelFading[i] = false; } } } }
public virtual void InternalUpdate(DeltaGameTime time) { OnBeginUpdate(time); Update(time); OnEndUpdate(time); }