So far, nothing uses this for the elapsed time. But it may be useful at some point. Maybe sound syncing?
Inheritance: System.EventArgs
コード例 #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);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: andreinitescu/cs_megaman
        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;
        }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
        private void MoveUpdate(GameTickEventArgs e)
        {
            x += vx;
            y += vy;
            moveFrame++;

            if (moveFrame >= duration)
            {
                x = stopX;
                y = stopY;
                Engine.Instance.GameLogicTick -= MoveUpdate;
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #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);
         }
     }
 }
コード例 #7
0
 protected virtual void Tick(GameTickEventArgs e)
 {
     if (GameThink != null)
     {
         GameThink();
     }
     if (GameAct != null)
     {
         GameAct();
     }
     if (GameReact != null)
     {
         GameReact();
     }
     if (GameCleanup != null)
     {
         GameCleanup();
     }
 }
コード例 #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;
        }
コード例 #9
0
ファイル: Engine.cs プロジェクト: sndcode/C--MegaMan-Engine
        // 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);
        }
コード例 #10
0
ファイル: Scene.cs プロジェクト: laazer/cs_megaman
        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);
            }
        }
コード例 #11
0
ファイル: GameHandler.cs プロジェクト: laazer/cs_megaman
 protected virtual void Tick(GameTickEventArgs e)
 {
     if (GameThink != null) GameThink();
     if (GameAct != null) GameAct();
     if (GameReact != null) GameReact();
     if (GameCleanup != null) GameCleanup();
 }
コード例 #12
0
        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;
            }
        }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: laazer/cs_megaman
 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;
 }
コード例 #14
0
 private void Update(GameTickEventArgs e)
 {
     sprite.Update();
 }
コード例 #15
0
 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;
     }
 }
コード例 #16
0
        private void MoveUpdate(GameTickEventArgs e)
        {
            x += vx;
            y += vy;
            moveFrame++;

            if (moveFrame >= duration)
            {
                x = stopX;
                y = stopY;
                Engine.Instance.GameLogicTick -= MoveUpdate;
            }
        }
コード例 #17
0
ファイル: Engine.cs プロジェクト: Tesserex/C--MegaMan-Engine
        // 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;
        }
コード例 #18
0
ファイル: HealthMeter.cs プロジェクト: laazer/cs_megaman
 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);
     }
 }
コード例 #19
0
ファイル: StageHandler.cs プロジェクト: laazer/cs_megaman
        protected override void Tick(GameTickEventArgs e)
        {
            if (updateFunc != null) updateFunc();

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

            base.Tick(e);
        }
コード例 #20
0
 private void Update(GameTickEventArgs e)
 {
     sprite.Update();
 }