public override sealed void Update(GameTime gameTime) { //if (Guide.IsVisible) //{ // return; //} UiManager.Update(gameTime); if (!IsGamePaused) { ElapsedUnpausedTime += gameTime.ElapsedGameTime; } _components.Commit(); //Commit recent changes to the mutable set bool someComponentStillLoading = false; foreach (TdglComponent component in _components) { if (ComponentsStillLoading) { if (!component.IsLoaded) { someComponentStillLoading = true; //keep trying to load components component.LoadWait(gameTime); } } else if (component != UiManager) //UiManager was already updated earlier { if (!IsGamePaused || component.IsPauseIgnored) { component.Update(gameTime); } } //If the draw order for any component has changed, need to re-sort all components by draw index in the next update if (!_componentDrawOrders.ContainsKey(component) || _componentDrawOrders[component] != component.DrawOrder) { needToSortComponentsByDrawOrder = true; } _componentDrawOrders[component] = component.DrawOrder; } if (ComponentsStillLoading && !someComponentStillLoading) { ComponentsStillLoading = false; //done loading } else if (!ComponentsStillLoading && !ComponentsFinishedLoading) { ComponentsFinishedLoading = true; //done loading, finished updating each component exactly once } }
public override void Update(GameTime gameTime) { foreach (Mob mob in Mobs) { mob.AlreadyCollided.Clear(); } foreach (Mob mob in Mobs) { if (mob.IsUpdateEnabled) { InspectMob(mob); mob.Update(gameTime); if (mob.IsDrawEnabled) { mob.AnimatedSprite.Update(gameTime); } } if (!(mob is DrawOnlyMob)) { MobBucketManager.UpdateMobBucket(mob); } } MobBucketManager.Update(); _mobs.Commit(); }