public StateSpaceComponents() { EntitiesToDelete = new List <Guid>(); Entities = new List <Entity>(); PositionComponents = new Dictionary <Guid, PositionComponent>(); VelocityComponents = new Dictionary <Guid, VelocityComponent>(); DisplayComponents = new Dictionary <Guid, DisplayComponent>(); AnimationComponents = new Dictionary <Guid, AnimationComponent>(); LabelComponents = new Dictionary <Guid, LabelComponent>(); SightRadiusComponents = new Dictionary <Guid, SightRadiusComponent>(); SkillLevelsComponents = new Dictionary <Guid, SkillLevelsComponent>(); TargetPositionComponents = new Dictionary <Guid, TargetPositionComponent>(); DirectionComponents = new Dictionary <Guid, DirectionComponent>(); TimeToLiveComponents = new Dictionary <Guid, TimeToLiveComponent>(); CollisionComponents = new Dictionary <Guid, CollisionComponent>(); NameComponents = new Dictionary <Guid, NameComponent>(); AICombatComponents = new Dictionary <Guid, AICombat>(); AIAlignmentComponents = new Dictionary <Guid, AIAlignment>(); AIStateComponents = new Dictionary <Guid, AIState>(); AIFieldOfViewComponents = new Dictionary <Guid, AIFieldOfView>(); AISleepComponents = new Dictionary <Guid, AISleep>(); AIRoamComponents = new Dictionary <Guid, AIRoam>(); AIFleeComponents = new Dictionary <Guid, AIFlee>(); InputMovementComponents = new Dictionary <Guid, InputMovementComponent>(); EntityMessageComponents = new Dictionary <Guid, EntityMessageComponent>(); AlternateFOVColorChangeComponents = new Dictionary <Guid, AlternateFOVColorChangeComponent>(); HealthRegenerationComponents = new Dictionary <Guid, HealthRegenerationComponent>(); OutlineComponents = new Dictionary <Guid, OutlineComponent>(); SecondaryOutlineComponents = new Dictionary <Guid, SecondaryOutlineComponent>(); InventoryComponents = new Dictionary <Guid, InventoryComponent>(); PickupComponents = new Dictionary <Guid, PickupComponent>(); StatModificationComponents = new Dictionary <Guid, StatModificationComponent>(); ValueComponents = new Dictionary <Guid, ValueComponent>(); ItemFunctionsComponents = new Dictionary <Guid, ItemFunctionsComponent>(); PassivesComponents = new Dictionary <Guid, PassivesComponent>(); ArtifactStatsComponents = new Dictionary <Guid, ArtifactStatsComponent>(); BurningComponents = new Dictionary <Guid, BurningComponent>(); GlobalCollisionComponent = new GlobalCollisionComponent() { EntitiesThatCollided = new List <Guid>() }; PlayerComponent = new PlayerComponent(); GameMessageComponent = new GameMessageComponent(); GameplayInfoComponent = new GameplayInfoComponent(); ObserverComponent = new ObserverComponent() { Observed = new List <Guid>() }; InventoryMenuComponent = new InventoryMenuComponent(); DelayedActions = new List <Action>(); random = new Random(); }
public static void PrintObserver(StateSpaceComponents spaceComponents, SpriteFont font, SpriteBatch spriteBatch, DungeonTile[,] dungeonGrid, Camera camera, Texture2D UITexture) { ObserverComponent observer = spaceComponents.ObserverComponent; Entity observerInfo = spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.Observer) == ComponentMasks.Observer).FirstOrDefault(); if (observerInfo != null) { //Find out where the observer is PositionComponent observerPosition = spaceComponents.PositionComponents[observerInfo.Id]; //Obtain the list of entities from the observer component List <Entity> observedItems = new List <Entity>(); foreach (Guid id in observer.Observed) { Entity entity = spaceComponents.Entities.Where(x => x.Id == id).FirstOrDefault(); if (entity != null) { observedItems.Add(entity); } } //Set the initial variables int messageSpacing = (int)font.MeasureString("g").Y + 1; int messageLeft = 0; int messageRight = 0; int panelWidth = (int)((camera.DungeonViewport.Width / 2) - (DevConstants.Grid.CellSize * 2)); List <Tuple <Color, string> > leftFindings = new List <Tuple <Color, string> >(); List <Tuple <Color, string> > rightFindings = new List <Tuple <Color, string> >(); //Gather information for the left side if (!dungeonGrid[(int)observerPosition.Position.X, (int)observerPosition.Position.Y].Found) { leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, Messages.Observer.NotFound)); } else { if (dungeonGrid[(int)observerPosition.Position.X, (int)observerPosition.Position.Y].InRange) { leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Good, Messages.Observer.InRange)); } else { leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, Messages.Observer.OutOfRange)); } leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); switch (dungeonGrid[(int)observerPosition.Position.X, (int)observerPosition.Position.Y].Type) { case TileType.TILE_FLOOR: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Floor)); break; case TileType.TILE_WALL: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Wall)); break; case TileType.TILE_ROCK: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Rock)); break; case TileType.TILE_WATER: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Water)); break; case TileType.TILE_TALLGRASS: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.TallGrass)); break; case TileType.TILE_FLATTENEDGRASS: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.FlatGrass)); break; case TileType.TILE_FIRE: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Fire)); break; case TileType.TILE_ASH: leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Ash)); break; } } if (observer.SeeUnknown) { leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.Observer.Unknown)); } if (observer.Observed.Count > 0) { leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); leftFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, "From here you can see the following: ")); } //Gather observed names for the left side foreach (Entity en in observedItems) { string prepend = (en.Id == observer.SelectedItem) ? "> " : string.Empty; Color color = (en.Id == observer.SelectedItem) ? Colors.Messages.LootPickup : Colors.Messages.Normal; leftFindings.Add(new Tuple <Color, string>(color, prepend + spaceComponents.NameComponents[en.Id].Name)); } //Gather information for right side Entity selectedEntity = spaceComponents.Entities.Where(x => x.Id == observer.SelectedItem).FirstOrDefault(); if (selectedEntity != null) { if (spaceComponents.NameComponents[selectedEntity.Id].Name == "You") { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("You see yourself here."))); } else { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, spaceComponents.NameComponents[selectedEntity.Id].Name)); } rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, spaceComponents.NameComponents[selectedEntity.Id].Description)); //If the finding is an AI, gather the information for it if ((selectedEntity.ComponentFlags & ComponentMasks.ObservableAI) == ComponentMasks.ObservableAI) { AIState state = spaceComponents.AIStateComponents[selectedEntity.Id]; AIAlignment alignment = spaceComponents.AIAlignmentComponents[selectedEntity.Id]; SkillLevelsComponent skills = spaceComponents.SkillLevelsComponents[selectedEntity.Id]; switch (alignment.Alignment) { case AIAlignments.ALIGNMENT_NONE: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, "Neutral")); break; case AIAlignments.ALIGNMENT_HOSTILE: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, "Hostile")); break; case AIAlignments.ALIGNMENT_FRIENDLY: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Good, "Friendly")); break; } switch (state.State) { case AIStates.STATE_SLEEPING: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.StatusChange, "Sleeping")); break; case AIStates.STATE_ROAMING: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.StatusChange, "Roaming")); break; case AIStates.STATE_ATTACKING: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.StatusChange, "Attacking")); break; case AIStates.STATE_FLEEING: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.StatusChange, "Fleeing")); break; } //Status Effects: Statuses statuses = StatusSystem.GetStatusEffectsOfEntity(spaceComponents, selectedEntity.Id, dungeonGrid); if (statuses == Statuses.NONE) { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.StatusMessages.Normal)); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); } //If there are status effects on the player.. else { if ((statuses & Statuses.BURNING) == Statuses.BURNING) { BurningComponent burning = spaceComponents.BurningComponents[selectedEntity.Id]; rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, string.Format(Messages.StatusMessages.Burning, burning.MinDamage, burning.MaxDamage, burning.TurnsLeft))); } if ((statuses & Statuses.UNDERWATER) == Statuses.UNDERWATER) { rightFindings.Add(new Tuple <Color, string>(Colors.Caves.WaterInRange, Messages.StatusMessages.Underwater)); } if ((statuses & Statuses.HEALTHREGEN) == Statuses.HEALTHREGEN) { HealthRegenerationComponent healthRegen = spaceComponents.HealthRegenerationComponents[selectedEntity.Id]; rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Good, string.Format(Messages.StatusMessages.HealthRegen, healthRegen.HealthRegain, healthRegen.RegenerateTurnRate))); } rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); } Entity player = spaceComponents.Entities.Where(x => (x.ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER).First(); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Health: {0} / {1}", skills.CurrentHealth, skills.Health))); if (alignment.Alignment != AIAlignments.ALIGNMENT_FRIENDLY) { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Good, string.Format("You have a {0}% chance to hit.", Math.Ceiling(CombatSystem.CalculateAccuracy(spaceComponents, spaceComponents.SkillLevelsComponents[player.Id], player.Id, skills, selectedEntity.Id))))); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, string.Format("It has a {0}% chance of hitting you for a maximum of {1}.", Math.Ceiling(CombatSystem.CalculateAccuracy(spaceComponents, skills, selectedEntity.Id, spaceComponents.SkillLevelsComponents[player.Id], player.Id)), skills.MaximumDamage))); } } //If the observed item is an item, gather that information instead if ((selectedEntity.ComponentFlags & ComponentMasks.ObservableItem) == ComponentMasks.ObservableItem) { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); PickupComponent pickup = spaceComponents.PickupComponents[selectedEntity.Id]; switch (pickup.PickupType) { case ItemType.GOLD: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Special, "Gold")); break; case ItemType.CONSUMABLE: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.LootPickup, "Consumable")); break; case ItemType.ARTIFACT: rightFindings.Add(new Tuple <Color, string>(Colors.Messages.LootPickup, "Artifact")); break; } if ((selectedEntity.ComponentFlags & ComponentMasks.ObservableValue) == ComponentMasks.ObservableValue && pickup.PickupType != ItemType.DOWNSTAIRS) { ValueComponent value = spaceComponents.ValueComponents[selectedEntity.Id]; rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format("This item is worth {0} gold.", value.Gold))); } if ((selectedEntity.ComponentFlags & ComponentMasks.ObservableSkillModifications) == ComponentMasks.ObservableSkillModifications) { StatModificationComponent stats = spaceComponents.StatModificationComponents[selectedEntity.Id]; rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, "This artifact affects the following stats: ")); if (stats.AccuracyChange != 0) { string sign = stats.AccuracyChange > 0 ? "+" : string.Empty; Color color = stats.AccuracyChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Accuracy {0}{1}", sign, stats.AccuracyChange))); } if (stats.DefenseChange != 0) { string sign = stats.DefenseChange > 0 ? "+" : string.Empty; Color color = stats.DefenseChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Defense {0}{1}", sign, stats.DefenseChange))); } if (stats.HealthChange != 0) { string sign = stats.HealthChange > 0 ? "+" : string.Empty; Color color = stats.HealthChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Maximum Health {0}{1}", sign, stats.HealthChange))); } if (stats.DieNumberChange != 0) { string sign = stats.DieNumberChange > 0 ? "+" : string.Empty; Color color = stats.DieNumberChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Dice Number on Attack {0}{1}", sign, stats.DieNumberChange))); } if (stats.MinimumDamageChange != 0) { string sign = stats.MinimumDamageChange > 0 ? "+" : string.Empty; Color color = stats.MinimumDamageChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Minimum Damage {0}{1}", sign, stats.MinimumDamageChange))); } if (stats.MaximumDamageChange != 0) { string sign = stats.MaximumDamageChange > 0 ? "+" : string.Empty; Color color = stats.MaximumDamageChange > 0 ? Colors.Messages.Good : Colors.Messages.Bad; rightFindings.Add(new Tuple <Color, string>(color, string.Format("Maximum Damage {0}{1}", sign, stats.MaximumDamageChange))); } } if ((selectedEntity.ComponentFlags & ComponentMasks.ObservableUsage) == ComponentMasks.ObservableUsage) { ItemFunctionsComponent funcs = spaceComponents.ItemFunctionsComponents[selectedEntity.Id]; rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine)); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Good, string.Format("This item has {0} uses left.", funcs.Uses))); rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Bad, string.Format("This item loses {0} value per use.", funcs.CostToUse))); if (funcs.Ranged) { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, "This item is cast at a range.")); } else { rightFindings.Add(new Tuple <Color, string>(Colors.Messages.Normal, "This item is used where you stand.")); } } } } //Draw sections //Left section spriteBatch.Draw(UITexture, new Rectangle(0, 0, panelWidth, (int)camera.DungeonViewport.Height), Color.Black * .5f); foreach (Tuple <Color, string> message in leftFindings) { if (string.IsNullOrEmpty(message.Item2)) { continue; } string text = MessageDisplaySystem.WordWrap(font, message.Item2, panelWidth - messageSpacing); float textHeight = font.MeasureString(message.Item2).Y; spriteBatch.DrawString(font, text, new Vector2(messageSpacing, messageSpacing + (messageLeft * messageSpacing)), message.Item1); messageLeft += Regex.Matches(text, System.Environment.NewLine).Count; messageLeft += 1; } //Right section if (observer.Observed.Count > 0) { spriteBatch.Draw(UITexture, new Rectangle((int)camera.DungeonViewport.Bounds.Right - panelWidth, 0, panelWidth, (int)camera.DungeonViewport.Height), Color.Black * .5f); foreach (Tuple <Color, string> message in rightFindings) { if (string.IsNullOrEmpty(message.Item2)) { continue; } string text = MessageDisplaySystem.WordWrap(font, message.Item2, panelWidth - messageSpacing); float textHeight = font.MeasureString(message.Item2).Y; spriteBatch.DrawString(font, text, new Vector2((int)camera.DungeonViewport.Bounds.Right - panelWidth + messageSpacing, messageSpacing + (messageRight * messageSpacing)), message.Item1); messageRight += Regex.Matches(text, System.Environment.NewLine).Count; messageRight += 1; } } } }
public static void HandleObserverFindings(StateSpaceComponents spaceComponents, KeyboardState key, KeyboardState prevKey, DungeonTile[,] dungeonGrid) { ObserverComponent observer = spaceComponents.ObserverComponent; Entity observerInfo = spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.Observer) == ComponentMasks.Observer).FirstOrDefault(); Vector2 playerPos = spaceComponents.PositionComponents[spaceComponents.Entities.Where(c => (c.ComponentFlags & ComponentMasks.Player) == ComponentMasks.Player).First().Id].Position; bool inWater = dungeonGrid[(int)playerPos.X, (int)playerPos.Y].Type == TileType.TILE_WATER; observer.SeeUnknown = false; if (observerInfo != null) { observer.Observed = new List <Guid>(); int selectedItem = 0; PositionComponent observerPosition = spaceComponents.PositionComponents[observerInfo.Id]; //gather a list of all observed items foreach (Guid id in spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.Observable) == ComponentMasks.Observable).Select(x => x.Id)) { PositionComponent enPos = spaceComponents.PositionComponents[id]; if (dungeonGrid[(int)observerPosition.Position.X, (int)observerPosition.Position.Y].InRange && enPos.Position == observerPosition.Position) { bool observedInWater = dungeonGrid[(int)enPos.Position.X, (int)enPos.Position.Y].Type == TileType.TILE_WATER; if (observedInWater != inWater) { observer.SeeUnknown = true; break; } observer.Observed.Add(id); } } //set the current observed item to the first item if there isn't one yet if ((observer.SelectedItem == Guid.Empty && observer.Observed.Count > 0) || (observer.Observed.Count > 0 && !observer.Observed.Contains(observer.SelectedItem))) { observer.SelectedItem = observer.Observed[selectedItem]; } //set the index of the selected item if (observer.Observed.Count > 0) { selectedItem = observer.Observed.IndexOf(observer.SelectedItem); } //Change the index if necessary if (key.IsKeyDown(Keys.Down) && prevKey.IsKeyUp(Keys.Down)) { selectedItem += 1; if (selectedItem >= observer.Observed.Count) { selectedItem = 0; } } else if (key.IsKeyDown(Keys.Up) && prevKey.IsKeyUp(Keys.Up)) { selectedItem -= 1; if (selectedItem < 0) { selectedItem = observer.Observed.Count - 1; } } //Update the component if (observer.Observed.Count > 0) { observer.SelectedItem = observer.Observed[selectedItem]; } spaceComponents.ObserverComponent = observer; } }
public IStateSpace UpdateSpace(GameTime gameTime, ContentManager content, GraphicsDeviceManager graphics, KeyboardState prevKeyboardState, MouseState prevMouseState, GamePadState prevGamepadState, Camera camera, ref GameSettings gameSettings) { IStateSpace nextStateSpace = this; //Check to see if the player has died if (stateSpaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.Player) == ComponentMasks.Player).Count() == 0) { //Game End, High Score, and Save Data handling } else {//Check to see if the next level needs to be loaded if (stateSpaceComponents.PlayerComponent.GoToNextFloor || Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { nextStateSpace = new RandomlyGeneratedStateSpace(new CaveGeneration(), 75, 125); PlayerComponent player = stateSpaceComponents.PlayerComponent; player.GoToNextFloor = false; player.PlayerJustLoaded = true; stateSpaceComponents.PlayerComponent = player; LevelChangeSystem.RetainPlayerStatistics(stateComponents, stateSpaceComponents); LevelChangeSystem.RetainNecessaryComponents(stateComponents, stateSpaceComponents); } //Toggle Inventory Menu if (Keyboard.GetState().IsKeyDown(Keys.I) && prevKeyboardState.IsKeyUp(Keys.I) && !showObserver) { showInventory = !showInventory; } else if (Keyboard.GetState().IsKeyDown(Keys.Enter) && prevKeyboardState.IsKeyUp(Keys.Enter) && !showInventory) { //If observer exists, remove it and add input component to player(s), otherwise, remove input component from all players and create an observer. if (ObserverSystem.CreateOrDestroyObserver(stateSpaceComponents)) { showObserver = true; } else { showObserver = false; } } //Actions to complete if the inventory is open if (showInventory) { //Deletion and Cleanup if (stateSpaceComponents.EntitiesToDelete.Count > 0) { foreach (Guid entity in stateSpaceComponents.EntitiesToDelete) { stateSpaceComponents.DestroyEntity(entity); } stateSpaceComponents.EntitiesToDelete.Clear(); } showInventory = InventorySystem.HandleInventoryInput(stateSpaceComponents, gameTime, prevKeyboardState, Keyboard.GetState()); } //Actions to complete if inventory is not open if (showObserver) { ObserverComponent observer = stateSpaceComponents.ObserverComponent; observer.Observed = new List <Guid>(); stateSpaceComponents.ObserverComponent = observer; InputMovementSystem.HandleDungeonMovement(stateSpaceComponents, graphics, gameTime, prevKeyboardState, prevMouseState, prevGamepadState, camera, dungeonGrid, dungeonDimensions); CameraSystem.UpdateCamera(camera, gameTime, stateSpaceComponents, DevConstants.Grid.CellSize, prevKeyboardState); ObserverSystem.HandleObserverFindings(stateSpaceComponents, Keyboard.GetState(), prevKeyboardState, dungeonGrid); stateSpaceComponents.InvokeDelayedActions(); } else if (!showInventory && !showObserver) { //Deletion and Cleanup DestructionSystem.UpdateDestructionTimes(stateSpaceComponents, gameTime); //Non-turn-based AnimationSystem.UpdateFovColors(stateSpaceComponents, gameTime); AnimationSystem.UpdateOutlineColors(stateSpaceComponents, gameTime); MovementSystem.UpdateMovingEntities(stateSpaceComponents, gameTime); MovementSystem.UpdateIndefinitelyMovingEntities(stateSpaceComponents, gameTime); //Movement and Reaction InputMovementSystem.HandleDungeonMovement(stateSpaceComponents, graphics, gameTime, prevKeyboardState, prevMouseState, prevGamepadState, camera, dungeonGrid, dungeonDimensions); CameraSystem.UpdateCamera(camera, gameTime, stateSpaceComponents, DevConstants.Grid.CellSize, prevKeyboardState); TileSystem.RevealTiles(ref dungeonGrid, dungeonDimensions, stateSpaceComponents); TileSystem.IncreaseTileOpacity(ref dungeonGrid, dungeonDimensions, gameTime, stateSpaceComponents); MessageDisplaySystem.ScrollMessage(prevKeyboardState, Keyboard.GetState(), stateSpaceComponents); DungeonMappingSystem.ShouldPlayerMapRecalc(stateSpaceComponents, dungeonGrid, dungeonDimensions, ref mapToPlayer); //AI and Combat AISystem.AICheckDetection(stateSpaceComponents); AISystem.AIMovement(stateSpaceComponents, dungeonGrid, dungeonDimensions, mapToPlayer); InventorySystem.TryPickupItems(stateSpaceComponents, dungeonGrid); AISystem.AIUpdateVision(stateSpaceComponents, dungeonGrid, dungeonDimensions); CombatSystem.HandleMeleeCombat(stateSpaceComponents, DevConstants.Grid.CellSize); AISystem.AICheckFleeing(stateSpaceComponents); //End-Of-Turn Status Effects StatusSystem.RegenerateHealth(stateSpaceComponents); StatusSystem.ApplyBurnDamage(stateSpaceComponents, dungeonGrid); TileSystem.SpreadFire(ref dungeonGrid, dungeonDimensions, stateSpaceComponents); //Resetting Systems if (stateSpaceComponents.PlayerComponent.PlayerJustLoaded || stateSpaceComponents.PlayerComponent.PlayerTookTurn) { PlayerComponent player = stateSpaceComponents.PlayerComponent; player.PlayerJustLoaded = false; player.PlayerTookTurn = false; stateSpaceComponents.PlayerComponent = player; } CollisionSystem.ResetCollision(stateSpaceComponents); if (stateSpaceComponents.EntitiesToDelete.Count > 0) { foreach (Guid entity in stateSpaceComponents.EntitiesToDelete) { stateSpaceComponents.DestroyEntity(entity); } stateSpaceComponents.EntitiesToDelete.Clear(); } stateSpaceComponents.InvokeDelayedActions(); } } return(nextStateSpace); }