protected override void Tick(GameTickEventArgs e) { if (waiting) { base.Tick(e); return; } foreach (var keyframe in info.KeyFrames) { if (keyframe.Frame == frame) { if (keyframe.Fade) { KeyFrameInfo frameInfo = keyframe; // for closure Engine.Instance.FadeTransition(() => TriggerKeyFrame(frameInfo)); } else { TriggerKeyFrame(keyframe); } } } base.Tick(e); frame++; if (frame >= info.Duration) { Finish(info.NextHandler); } }
void Instance_GameLogicTick(GameTickEventArgs e) { float fps = 1 / e.TimeElapsed; fpsLabel.Text = "FPS: " + fps.ToString("N2"); thinkLabel.Text = "Busy: " + (Engine.Instance.ThinkTime * 100).ToString("N0") + "%"; entityLabel.Text = "Entities: " + Game.DebugEntitiesAlive(); fpsCapLabel.Text = "FPS Cap: " + Engine.Instance.FPS; }
private void Update(GameTickEventArgs e) { frame++; if (frame >= speed && displayed.Length < Content.Length) { // add a character to the displayed text displayed += Content.Substring(displayed.Length, 1); frame = 0; } }
private void MoveUpdate(GameTickEventArgs e) { x += vx; y += vy; moveFrame++; if (moveFrame >= duration) { x = stopX; y = stopY; Engine.Instance.GameLogicTick -= MoveUpdate; } }
private void Update(GameTickEventArgs e) { x += vx; y += vy; width += vw; height += vh; moveFrame++; if (moveFrame >= duration) { x = stopX; y = stopY; width = stopWidth; height = stopHeight; Engine.Instance.GameLogicTick -= Update; } }
private void GameTick(GameTickEventArgs e) { UpTick(); if (value >= stopvalue || value >= maxvalue) { Engine.Instance.GameLogicTick -= GameTick; animating = false; if (IsPlayer) { container.ResumeHandler(); } if (sound != null) { Engine.Instance.SoundSystem.StopSfx(sound); } } }
protected virtual void Tick(GameTickEventArgs e) { if (GameThink != null) { GameThink(); } if (GameAct != null) { GameAct(); } if (GameReact != null) { GameReact(); } if (GameCleanup != null) { GameCleanup(); } }
protected virtual void Tick(GameTickEventArgs e) { if (GameThink != null) { GameThink(); } if (GameAct != null) { GameAct(); } if (GameReact != null) { GameReact(); } if (GameCleanup != null) { GameCleanup(); } DidGravityFlipPreviousFrame = (IsGravityFlipped != _previousGravityFlip); _previousGravityFlip = IsGravityFlipped; }
// Executes one step (frame) of the game, both logic and drawing. The parameter is time // since last frame, but it isn't actually used except in the tick event. No one uses it // there either. private bool Step(float dt) { CheckInput(); GameTickEventArgs e = new GameTickEventArgs(dt); if (GameLogicTick != null) { GameLogicTick(e); // this one is for more basic operations } // render phase GameRenderEventArgs r = new GameRenderEventArgs(renderContext); GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Green); if (GameRenderBegin != null) { GameRenderBegin(r); } renderContext.SetOpacity(opacity); renderContext.Begin(); if (GameRender != null) { GameRender(r); } renderContext.End(); if (GameRenderEnd != null) { GameRenderEnd(r); } return(false); }
protected virtual void Tick(GameTickEventArgs e) { if (GameThink != null) GameThink(); if (GameAct != null) GameAct(); if (GameReact != null) GameReact(); if (GameCleanup != null) GameCleanup(); }
private void Update(GameTickEventArgs e) { sprite.Update(); }
// Executes one step (frame) of the game, both logic and drawing. The parameter is time // since last frame, but it isn't actually used except in the tick event. No one uses it // there either. private bool Step(float dt) { CheckInput(); GameTickEventArgs e = new GameTickEventArgs(dt); if (GameLogicTick != null) GameLogicTick(e); // this one is for more basic operations // render phase GameRenderEventArgs r = new GameRenderEventArgs(renderContext); GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Green); if (GameRenderBegin != null) GameRenderBegin(r); renderContext.SetOpacity(opacity); renderContext.Begin(); if (GameRender != null) GameRender(r); renderContext.End(); if (GameRenderEnd != null) GameRenderEnd(r); return false; }
private void GameTick(GameTickEventArgs e) { UpTick(); if (value >= stopvalue || value >= maxvalue) { Engine.Instance.GameLogicTick -= GameTick; animating = false; if (IsPlayer) container.ResumeHandler(); if (sound != null) Engine.Instance.SoundSystem.StopSfx(sound); } }
protected override void Tick(GameTickEventArgs e) { if (updateFunc != null) updateFunc(); foreach (Tile t in info.Tileset) { t.Sprite.Update(); } base.Tick(e); }