protected override void Update(GameTime gameTime) { OnPreUpdate.Raise(this, new GameTimeEventArgs(gameTime)); OnUpdate.Raise(this, new GameTimeEventArgs(gameTime)); base.Update(gameTime); OnPostUpdate.Raise(this, new GameTimeEventArgs(gameTime)); }
/// <summary> /// Raises the <see cref="E:GameUpdate" /> event. /// </summary> /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param> private static void OnGameUpdate(EventArgs args) { try { OnPreUpdate?.Invoke(args); OnUpdate?.Invoke(args); OnPostUpdate?.Invoke(args); } catch (Exception ex) { Console.WriteLine(ex); } }
/// <summary> /// Updates the GameObject. Applies physics and such. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> void IGameObject.Update(GameTime gameTime) { if (OnPreUpdate != null) { foreach (Func <GameTime, bool> delg in OnPreUpdate.GetInvocationList()) { if (!delg.Invoke(gameTime)) { return; } } } updatePhysics(gameTime); OnPostUpdate?.Invoke(gameTime); }
/// <summary> /// Executes Update events. /// </summary> internal static void CallUpdateEvents(GameTime gameTime) { TimeKeeper._elapsedTime = GameMgr.ElapsedTime; OnPreUpdate?.Invoke(); foreach (var scene in Scenes) { if (scene.Enabled) { CurrentScene = scene; scene.Update(); } } OnPostUpdate?.Invoke(); }
internal static void RaisePreUpdate() { OnPreUpdate?.Invoke(); }