So far, nothing uses this for the elapsed time. But it may be useful at some point. Maybe sound syncing?
Inheritance: System.EventArgs
Example #1
0
        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);
            }
        }
Example #2
0
        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;
            }
        }
Example #6
0
 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);
         }
     }
 }
Example #7
0
 protected virtual void Tick(GameTickEventArgs e)
 {
     if (GameThink != null)
     {
         GameThink();
     }
     if (GameAct != null)
     {
         GameAct();
     }
     if (GameReact != null)
     {
         GameReact();
     }
     if (GameCleanup != null)
     {
         GameCleanup();
     }
 }
Example #8
0
        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;
        }
Example #9
0
        // 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);
        }
Example #10
0
        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);
            }
        }
Example #11
0
 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)
        {
            x += vx;
            y += vy;
            width += vw;
            height += vh;
            moveFrame++;

            if (moveFrame >= duration)
            {
                x = stopX;
                y = stopY;
                width = stopWidth;
                height = stopHeight;
                Engine.Instance.GameLogicTick -= Update;
            }
        }
Example #13
0
 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)
 {
     sprite.Update();
 }
 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;
            }
        }
Example #17
0
        // 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;
        }
Example #18
0
 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);
     }
 }
Example #19
0
        protected override void Tick(GameTickEventArgs e)
        {
            if (updateFunc != null) updateFunc();

            foreach (Tile t in info.Tileset)
            {
                t.Sprite.Update();
            }

            base.Tick(e);
        }
Example #20
0
 private void Update(GameTickEventArgs e)
 {
     sprite.Update();
 }