Exemple #1
0
        private void Initialization()
        {
            try
            {
                this.LoadNpcConfig("Game\\Settings\\npcList.xml", out npcNames, out controlMechanisms, out positions, out characterNames, out actionsName);
            }
            catch (Exception ex)
            {
                Logging.Logger.AddError("Chyba pri nacitani konfigurace NPC! " + ex.ToString());
                throw;
            }


            gameNpcs   = new GameNPC[npcNames.Count];
            characters = new WiccanRede.AI.CharacterNPC[npcNames.Count];

            for (int i = 0; i < npcNames.Count; i++)
            {
                try
                {
                    characters[i]      = new WiccanRede.AI.CharacterNPC("Settings\\NPC\\" + characterNames[i] + ".xml");
                    characters[i].name = npcNames[i];

                    if (!this.controlMechanisms[i].EndsWith(".lua"))
                    {
                        gameNpcs[i] = new GameNPC(characters[i], this.logic, controlMechanisms[i], positions[i], "Settings\\" + actionsName[i] + ".xml");
                    }
                    else
                    {
                        gameNpcs[i] = new GameNPC(characters[i], this.logic, "Scripting\\Scripts\\" + controlMechanisms[i], positions[i], "Settings\\" + actionsName[i] + ".xml");
                    }
                }
                catch (Exception ex)
                {
                    Logging.Logger.AddWarning("Chyba pri nacitani NPC: " + ex.ToString());
                }
            }
            GameNPC player = new GameNPC(this.logic, new AI.CharacterNPC("Settings\\NPC\\Player.xml"));

            gameStateMachine = new GameStateMachine("Game\\Settings\\OpeningLevel.xml");
        }
Exemple #2
0
        private void Init()
        {
            grid = new Grid(new Bitmap("Settings/map.png"), null);
            ai   = new AICore(grid);
            //ai.AddPlayer(mikelChar, new Microsoft.DirectX.Vector3(0, 0, 0), new Entity(), "BasicFSM");
            //ai.AddPlayer(mikelChar, new Microsoft.DirectX.Vector3(0, 0, 0), new Entity(), "BasicFSM");

            string[] npcList = File.ReadAllLines(Directory.GetCurrentDirectory() + "\\Settings\\level1npc.ini");
            characters = new WiccanRede.AI.CharacterNPC[npcList.Length];

            for (int i = 0; i < npcList.Length; i++)
            {
                try
                {
                    characters[i] = new WiccanRede.AI.CharacterNPC("Settings\\" + npcList[i] + ".xml");
                    //ai.AddPlayer(characters[i], new Microsoft.DirectX.Vector3(i,i,i), new Entity(), "BasicFSM");
                }
                catch (Exception ex)
                {
                    Logging.Logger.AddWarning("Chyba pri nacitani NPC: " + npcList[i] + " - " + ex.ToString());
                }
            }
        }