private void UpdateFrame() { fc++; // update b offsets bOffsetX += B_SPEED_X; bOffsetY += B_SPEED_Y; if (Math.Abs(bOffsetY) > FOPS_LOGO.Height) { bOffsetY = 0; } if (Math.Abs(bOffsetX) > FOPS_LOGO.Width) { bOffsetX = 0; } // raindrops if (Raindrops) { if (rand.Next(100) <= 3) { int x = rand.Next(RAIN_MARGIN, SIZE - RAIN_MARGIN); int y = rand.Next(RAIN_MARGIN, SIZE - RAIN_MARGIN); int r = rand.Next(5, 10); effect.Splash(x, y, r); } } // update for (int i = 0; i < 3; i++) { // Pulse if (++cellPulseCount[i] == 60) { cellPulse[i] = TGT_PULSE; cellPulseCount[i] = 0; } // Apply Decay double dltDecay = (cellPulse[i] - INIT_PULSE) * DECAY; if (dltDecay < 0.003) { dltDecay = 0.003; } if (cellPulse[i] != INIT_PULSE) { cellPulse[i] -= dltDecay; if (cellPulse[i] < INIT_PULSE) { cellPulse[i] = INIT_PULSE; } } } effect.Update(); this.Invalidate(); }
// Wrapper so that update and rendering comes together private void UpdateFrame() { if (!DesignMode) // disable animation in designer { effect.Update(); Invalidate(); } }
protected override void Update(GameTime gameTime) { if (!IsPaused) { Ripple.Update(gameTime); Flash.Update(gameTime.ElapsedGameTime); ParticleEngine.Update(gameTime); if (CurrentState != null) { CurrentState = CurrentState.Update(gameTime); } } base.Update(gameTime); }