Update() public method

public Update ( ) : void
return void
示例#1
0
        protected override void Update(GameTime gameTime)
        {
            Sound.Update();
            Music.Play("music1");
            QuakeManager.Update();
            ControlInput.Update();

            FrameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (SlowTime > 0f)
            {
                SlowTime  -= FrameTime;
                FrameTime /= 10f;
            }

            switch (GameMode)
            {
            case GameModes.Playing:
                UpdateGame();
                break;

            case GameModes.Menu:
                if (Menu.MenuMode == MenuMode.Dead)
                {
                    var pTime = FrameTime;
                    FrameTime /= 3f;
                    UpdateGame();
                    FrameTime = pTime;
                }
                Menu.Update(this);
                break;
            }

            base.Update(gameTime);
        }
示例#2
0
        protected override void Update(GameTime gameTime)
        {
            if (!GameContent.IsLoaded)
            {
                base.Update(gameTime);
                return;
            }

            // Update KeyboardController for Commands
            keyboard.Update();

            Input.GetState();

            // Game implemented using Entity-Component-System,
            // Systems store instances of certain types of Components
            TransformSystem.Update(gameTime);
            BehaviorScriptSystem.Update(gameTime);
            ColliderSystem.Update(gameTime);
            ColliderSystem.Check();
            SpriteSystem.Update(gameTime);
            TextSystem.Update(gameTime);
            Sound.Update(gameTime);

            base.Update(gameTime);
        }
示例#3
0
 private void Update()
 {
     Time.Update();
     Scene.Update();
     Sound.Update();
     FSM.Update();
 }
示例#4
0
 /// <summary>Is called every frame.</summary>
 /// <param name="data">The data passed to the plugin.</param>
 public void Elapse(ElapseData data)
 {
     /*
      * How to access panel variables:
      * Panel[i] = 1;
      *
      * How to access sound variables:
      * Sound[i] = SoundInstructions.PlayOnce;
      * */
     // TODO: Your old Elapse code goes here.
     Sound.Update();
 }
示例#5
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            Sound.Update();
            Music.Play("music1");
            QuakeManager.Update();

            frameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            NetPlay.NetGame.FrameTime = FrameTime;

            frameTime *= 1.5f;

            if (SlowTime > 0f)
            {
                SlowTime  -= FrameTime;
                frameTime /= 10f;
            }

            NetPlay.Update(character, pManager);
            store.Update();

            switch (gameMode)
            {
            case GameModes.Playing:
                UpdateGame();

                break;

            case GameModes.Menu:
                if (menu.menuMode == Menu.MenuMode.Dead)
                {
                    float pTime = FrameTime;
                    frameTime /= 3f;
                    UpdateGame();

                    frameTime = pTime;
                }
                menu.Update(this);
                break;
            }

            base.Update(gameTime);
        }
示例#6
0
        protected override void Update(GameTime gameTime)
        {
            Sound.Update();
            Input.Update();

            // Exit using ESC
            if (Input.KeyboardEscapeJustPressed || Input.GamePadBackJustPressed)
            {
                this.Exit();
            }

            // Sound mute
            if (Input.KeyboardSounduteJustPressed)
            {
                Sound.MuteSound = !Sound.MuteSound;
            }

            base.Update(gameTime);
        }
示例#7
0
        protected override void Update(GameTime gameTime)
        {
            CurrentFrame++;
            Now = (float)gameTime.TotalGameTime.Ticks / 10000000f;
            DT  = (float)gameTime.ElapsedGameTime.Ticks / 10000000f;

            Input.Update(DT);
            Sound.Update(DT);

            if (State == GameState.Menu)
            {
                _mainMenu.Update(DT);
            }
            else if (State == GameState.Game)
            {
                Console.Update(DT);
                WindowManager.Update(DT);
                AreaChanger.Update(DT);
                GUI.Update(DT);
                PopupMessageManager.Update(DT);

                //Toggle options/exit
                if (/*!deathEffectManager->isActive() && */ !WindowManager.IsWindowOpen && SMH.Input.IsDown(Keys.Escape))
                {
                    SMH.WindowManager.OpenMiniMenu(MiniMenuMode.Exit);
                }

                if (!WindowManager.IsWindowOpen && !AreaChanger.IsChangingAreas)
                {
                    GameTime += DT;

                    Player.Update(DT);
                    Environment.Update(DT);
                    EnemyManager.Update(DT);
                    LootManager.Update(DT);
                    ProjectileManager.Update(DT);
                    NPCManager.Update(DT);
                }
            }
        }
示例#8
0
        /// <summary>Is called every frame.</summary>
        public void Elapse(ElapseData data)
        {
            if (data.PrecedingVehicle != null)
            {
                if (data.PrecedingVehicle.Distance < 0.2 && data.PrecedingVehicle.Distance > -1 && !crashed)
                {
                    if (data.Vehicle.Speed.KilometersPerHour > CrashSpeed)
                    {
                        crashed = true;
                        Panel[PanelManager.Crash] = 1;
                        SoundManager.Play(ATSSoundManager.Crash, 1.0, 1.0, false);
                    }
                }
            }

            Interlocker.update(data);
            SafetySystem.update(data);
            PanelManager.update(data, Panel);
            DVS.update(data);
            Misc.Update(data);
            Sound.Update();
        }