override public void Update(float systemTime) { // Snd update - keeps everything moving and updating smoothly sndEngine.Update(); // Single Step, Free running... Simulation.Update(systemTime); // Input InputMan.Update(); // Run based on simulation stepping if (Simulation.GetTimeStep() > 0.0f) { // Fire off the timer events TimerMan.Update(Simulation.GetTotalTime()); // walk through all objects and push to flyweight GameObjectMan.Update(); // Do the collision checks ColPairMan.Process(); // Delete any objects here... DelayedObjectMan.Process(); } }
// Author: Stahl Samuel, Yuetao Zhu public override void Update() { AudioEngine.Update(); if (music.Volume > 0.30f) { vol_delta = -0.002f; } else if (music.Volume < 0.00f) { vol_delta = 0.002f; } music.Volume += vol_delta; // Intentionally disabling sounds for now music.Volume = 0.000f; inputReader.GetInputs(); if (!isPaused) { //-------------------------------------------------------- // Rotate Sprite -- shows if game paused or not... //-------------------------------------------------------- pRedBird.angle = pRedBird.angle + 0.01f; pRedBird.Update(); BlockGrid grid = state.getGrid(); GameShape activeShape = state.getActiveShape(); // Things we need to check on every update: // 1. activeShape is placed => trigger GameState.activateNext() and set active shape to new active shape // 2. if timer is expired => reset timer and MovementManager.ApplyAction(InputAction.MoveDown,grid,shape); // 3. if timer is not expired => processInput(); if (activeShape.isPlaced) { //Update activeShape, lines, score, level, check game-over UpdateGameState(grid); } //if shape was placed, timer was just reset (mutually exclusive) else if (lineCycleTimer.IsExpired()) { Console.WriteLine($"Moving shape down: {activeShape}"); MovementManager.ApplyAction(InputAction.MoveDown, grid, activeShape); lineCycleTimer.ResetTimer(); inputTimer.ResetTimer(); } else { if (inputTimer.IsExpired()) { processInput(grid, activeShape); inputTimer.ResetTimer(); } } } else { if (inputTimer.IsExpired()) { // Paused processInput(null, null); inputTimer.ResetTimer(); } } }
public static void Update() { Debug.Assert(pSoundEngine != null); pSoundEngine.Update(); }
//----------------------------------------------------------------------------- // Game::Update() // Called once per frame, update data, tranformations, etc // Use this function to control process order // Input, AI, Physics, Animation, and Graphics //----------------------------------------------------------------------------- public override void Update() { // Snd update - Need to be called once a frame AudioEngine.Update(); //----------------------------------------------------------- // Input Test //----------------------------------------------------------- // InputTest.KeyboardTest(); // InputTest.MouseTest(); //----------------------------------------------------------- // Sound Experiments //----------------------------------------------------------- // Adjust music theme volume if (music.Volume > 0.30f) { vol_delta = -0.002f; } else if (music.Volume < 0.00f) { vol_delta = 0.002f; } music.Volume += vol_delta; //-------------------------------------------------------- // Rotate Sprite //-------------------------------------------------------- pRedBird.angle = pRedBird.angle + 0.01f; pRedBird.Update(); //-------------------------------------------------------- // Keyboard test //-------------------------------------------------------- // Quick hack to have a one off call. // you need to release the keyboard between calls if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER) && prevEnterKey == 0) { prevEnterKey = Azul.AZUL_KEY.KEY_ENTER; sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); } else { if (!Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER)) { prevEnterKey = 0; } } //-------------------------------------------------------- // Stats test //-------------------------------------------------------- stats.setScore(stats.getScore() + 1); if (statsCount % 400 == 0) { stats.setLevelNum(stats.getLevelNum() + 1); } if (statsCount % 50 == 0) { stats.setLineCount(stats.getLineCount() + 1); } statsCount++; }