コード例 #1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            await ItemTemplates.Load();

            await World.Load();

            await EntityNPCTemplates.Load();

            await Messages.Load();

            await EntityRelationshipTable.Load();

            // DEBUG
            // AppendParagraph(EntityRelationshipTable.DisplayString().ToParagraph());
            // END DEBUG

            // world update timer
            WorldUpdateTimer      = new Timer(Update, null, 1000, 50);
            CheckAppendQueueTimer = new Timer(CheckAppendQueue, null, 0, 100);

            // DEBUG
            AddDebug();
            // END DEBUG

            // initialize player
            Game.Initialize();
            ParsedInput input   = null;
            Handler     handler = Game.Player.DoLook(input);

            MessageQueue.Enqueue(handler.Message);
            // Messages.Display(handler.MessageCode, handler.ParagraphToAppend);

            //AppendParagraph(Game.Player.DoLook(input).ParagraphToAppend);
            txtInput.Focus(FocusState.Programmatic);
        }
コード例 #2
0
        private List <EntityNPCBase> GetListOfHostiles(EntityNPCBase source, bool bMustBeAlive = false)
        {
            List <EntityNPCBase> hostiles = new List <EntityNPCBase>();

            foreach (EntityNPCBase npc in Entities)
            {
                // ignore entities of same type
                if (npc.Faction.Equals(source.Faction))
                {
                    continue;
                }

                int relationship = EntityRelationshipTable.GetRelationship(source.Faction, npc.Faction);
                if (relationship < 0)
                {
                    if (!bMustBeAlive || !npc.IsDead)
                    {
                        hostiles.Add(npc);
                    }
                }
            }

            return(hostiles);
        }