Пример #1
0
        public static void SetRandomGlobalMessage(StateSpaceComponents spaceComponents, string[] messageList)
        {
            GameMessageComponent newMessage = spaceComponents.GameMessageComponent;

            newMessage.GlobalMessage             = messageList[spaceComponents.random.Next(0, messageList.Count())];
            spaceComponents.GameMessageComponent = newMessage;
        }
Пример #2
0
        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();
        }
Пример #3
0
        public static void ScrollMessage(KeyboardState prevKey, KeyboardState currentKey, StateSpaceComponents spaceComponents)
        {
            GameMessageComponent messageComponent = spaceComponents.GameMessageComponent;

            if (currentKey.IsKeyDown(Keys.PageUp) && !prevKey.IsKeyDown(Keys.PageUp))
            {
                messageComponent.IndexBegin = 0;
            }
            else if (currentKey.IsKeyDown(Keys.PageDown) && !prevKey.IsKeyDown(Keys.PageDown))
            {
                messageComponent.IndexBegin = messageComponent.GameMessages.Count - 1;
            }
            else if (currentKey.IsKeyDown(Keys.Down) && !prevKey.IsKeyDown(Keys.Down) && messageComponent.IndexBegin < messageComponent.GameMessages.Count - 1)
            {
                messageComponent.IndexBegin += 1;
            }
            else if (currentKey.IsKeyDown(Keys.Up) && !prevKey.IsKeyDown(Keys.Up) && messageComponent.IndexBegin > 0)
            {
                messageComponent.IndexBegin -= 1;
            }
            spaceComponents.GameMessageComponent = messageComponent;
        }