public override void Update(GameTime gameTime) { // Increment tick Tick++; //Ignore gametime. We are only bothered about ticks. // No dying in simulation //EnergyDeathSystem.Update(Tick, GameSpeed); //HealthDeathSystem.Update(Tick, GameSpeed); //OldAgeDeathSystem.Update(Tick, GameSpeed); // Update all systems that regard input values before updating brains _visionSystem.Update(); _noseSystem.Update(); //_brainSystem.Update(_settings.CritterTypes); // Following this update all systems that regard output _movementControlSystem.Update(); // If these systems have energy costs remember to update those systems before anything else happens, in case we need to cancel it _movementControlEnergyCostSystem.Update(SimDeltaTime); // These systems gather collisions between certain types of entities that are processed by other systems _rigidbodyCollisionSystem.GetCollisions(); _mouthCollisionSystem.GetCollisions(); _weaponHealthCollisionSystem.GetCollisions(); // Update the aforementioned systems to process the collisions RigidbodyCollisionSystem.Update(); MouthFoodCollisionSystem.Update(Tick, SimDeltaTime); WeaponSystem.Update(Tick, SimDeltaTime); // Calculate forces acting upon each body _rigidBodySystem.Update(SimDeltaTime); _dragSystem.Update(); // bounce entities on edge of the world WorldBorderSystem.Update(); // Actually modify transforms _velocitySystem.Update(SimDeltaTime); // Di not want this for editor //CritterPopulationSystem.Update(Tick, GameSpeed); //FoodRespawnSystem.Update(Tick, GameSpeed); //At the end of each loop update the hierarchy system so that it renders correctly and everything is ready for the next loop _transformHierarchySystem.Update(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); frontWeapon.Update(gameTime); frontWeapon.UpdateLocations(this.Center + this.frontWeaponPosition * scale, this.Rotation); //frontWeapon.SnapCenter(this.Center + this.frontWeaponPosition); frontWeapon.SnapCenter(center + RotateAboutOrigin(frontWeaponPosition * scale, new Vector2(0, 0), rotation)); leftWeapon.Update(gameTime); leftWeapon.UpdateLocations(this.Center + this.leftWeaponPosition * scale, this.Rotation); //leftWeapon.SnapCenter(this.Center + this.leftWeaponPosition); leftWeapon.SnapCenter(center + RotateAboutOrigin(leftWeaponPosition * scale, new Vector2(0, 0), rotation)); rightWeapon.Update(gameTime); rightWeapon.UpdateLocations(this.Center + this.rightWeaponPosition * scale, this.Rotation); //rightWeapon.SnapCenter(this.Center + this.rightWeaponPosition); rightWeapon.SnapCenter(center + RotateAboutOrigin(rightWeaponPosition * scale, new Vector2(0, 0), rotation)); }
/// <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 (InputHelper.GetInput(PlayerIndex.One).IsPressed(Keys.Escape, Buttons.Back)) { this.Exit(); } float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds; switch (GameState) { case GameState.SplashScreen: SplashSystem.Update(elapsedTime); break; case GameState.SignIn: // Requires at least one player to sign in if (Gamer.SignedInGamers.Count == 0) { if (IsActive) { Guide.ShowSignIn(4, false); InputHelper.DisableAll(); } } else { GameState = GameState.SplashScreen; SplashSystem.Load(SplashSystem.SplashType.GameStart); InputHelper.EnableAll(); if (!ContinueNewGameScreen.isConnected) { ContinueNewGameScreen.LoadContent(); ContinueNewGameScreen.isConnected = true; ContinueNewGameScreen.loadGameSaves(); } } break; case GameState.CharacterSelection: // TODO: Update character selection screen SpriteAnimationSystem.Update(elapsedTime); ContinueNewGameScreen.Update(gameTime); break; case GameState.NetworkSetup: NetworkSystem.Update(elapsedTime); break; case GameState.GameMenu: // TODO: Update game menu screen // Game Menu does not pause game! // Update game systems NetworkSystem.Update(elapsedTime); MovementSystem.Update(elapsedTime); break; case GameState.Gameplay: // Update game systems #if DEBUG if (InputHelper.GetInput(PlayerIndex.One).IsPressed(Keys.OemTilde)) { GameState = DungeonCrawler.GameState.SplashScreen; SplashSystem.Load(Systems.SplashSystem.SplashType.Credits); return; } #endif InputSystem.Update(elapsedTime); NetworkSystem.Update(elapsedTime); MovementSystem.Update(elapsedTime); WeaponSystem.Update(elapsedTime); SkillSystem.Update(elapsedTime); LevelManager.Update(elapsedTime); CollisionSystem.Update(elapsedTime); HUDSystem.Update(elapsedTime); QuestLogSystem.Update(elapsedTime); SpriteAnimationSystem.Update(elapsedTime); NpcAISystem.Update(elapsedTime); EnemyAISystem.Update(elapsedTime); TextSystem.Update(elapsedTime); EngineeringOffenseSystem.Update(elapsedTime); GarbagemanSystem.Update(elapsedTime); /* * if (pI.Health <= 0) * { * GameState = DungeonCrawler.GameState.SplashScreen; * SplashSystem.Load(Systems.SplashSystem.SplashType.GameOver); * return; * }*/ break; case GameState.Credits: // TODO: Update credits break; case GameState.RoomChange: NetworkSystem.Update(elapsedTime); RoomChangingSystem.Update(elapsedTime); break; } base.Update(gameTime); }
/// <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(); } if (GameState == DungeonCrawler.GameState.SignIn) { // Requires at least one player to sign in if (Gamer.SignedInGamers.Count == 0) { if (IsActive) { Guide.ShowSignIn(4, false); } } else { GameState = GameState.CharacterSelection; if (!ContinueNewGameScreen.isConnected) { ContinueNewGameScreen.LoadContent(); ContinueNewGameScreen.isConnected = true; ContinueNewGameScreen.loadGameSaves(); } } } float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds; switch (GameState) { case GameState.SplashScreen: // TODO: Update splash screens break; case GameState.SignIn: // Requires at least one player to sign in if (Gamer.SignedInGamers.Count == 0) { if (IsActive) { Guide.ShowSignIn(4, false); } } else { GameState = GameState.CharacterSelection; if (!ContinueNewGameScreen.isConnected) { ContinueNewGameScreen.LoadContent(); ContinueNewGameScreen.isConnected = true; ContinueNewGameScreen.loadGameSaves(); } } break; case GameState.CharacterSelection: // TODO: Update character selection screen SpriteAnimationSystem.Update(elapsedTime); ContinueNewGameScreen.Update(gameTime); break; case GameState.NetworkSetup: NetworkSystem.Update(elapsedTime); break; case GameState.GameMenu: // TODO: Update game menu screen // Game Menu does not pause game! // Update game systems NetworkSystem.Update(elapsedTime); MovementSystem.Update(elapsedTime); break; case GameState.Gameplay: // Update game systems InputSystem.Update(elapsedTime); NetworkSystem.Update(elapsedTime); MovementSystem.Update(elapsedTime); WeaponSystem.Update(elapsedTime); SkillSystem.Update(elapsedTime); LevelManager.Update(elapsedTime); CollisionSystem.Update(elapsedTime); QuestLogSystem.Update(elapsedTime); SpriteAnimationSystem.Update(elapsedTime); NpcAISystem.Update(elapsedTime); EnemyAISystem.Update(elapsedTime); TextSystem.Update(elapsedTime); GarbagemanSystem.Update(elapsedTime); break; case GameState.Credits: // TODO: Update credits break; case GameState.RoomChange: NetworkSystem.Update(elapsedTime); RoomChangingSystem.Update(elapsedTime); break; } base.Update(gameTime); }
private void Update() { meleeSystem?.Update(); rangedSystem?.Update(); }