Exemplo n.º 1
0
        public DuelRule()
        {
            BaseGame.ShowMouse = true;

            AIListForTank1 = new Combo("AIListForTank1", new Vector2(100, 100), 250);
            AIListForTank2 = new Combo("AIListForTank1", new Vector2(100, 300), 250);

            AIListForTank1.OnChangeSelection += new EventHandler(AIListForTank1_OnChangeSelection);
            AIListForTank2.OnChangeSelection += new EventHandler(AIListForTank2_OnChangeSelection);

            aiLoader = new AILoader();
            aiLoader.AddInterAI(typeof(DuelerNoFirst));
            aiLoader.AddInterAI(typeof(ManualControl));
            aiLoader.AddInterAI(typeof(DuelAIModel));
            aiLoader.AddInterAI(typeof(AutoShootAI));
            aiLoader.InitialCompatibleAIs(typeof(IDuelAIOrderServer), typeof(AICommonServer));
            foreach (string name in aiLoader.GetAIList())
            {
                AIListForTank1.AddItem(name);
                AIListForTank2.AddItem(name);
            }
            btn          = new TextButton("OkBtn", new Vector2(700, 500), "Begin", 0, Color.Yellow);
            btn.OnClick += new EventHandler(btn_OnPress);

            LoadResouce();
        }
Exemplo n.º 2
0
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            AILoader saved = new AILoader();

            mRules           = saved.LoadFromFile(Name);
            list.DataContext = mRules;
        }
Exemplo n.º 3
0
        public ServerCreator(WarServerManager server)
        {
            WarSMgr = server;

            AiLoader     = Core.ResEng.getLoader <AILoader>();
            virNpcLoader = Core.ResEng.getLoader <VirtualNpcLoader>();
            reader       = Core.Data.getIModelConfig <SceneEditorDataRead>();
        }
Exemplo n.º 4
0
 public Player(AILoader aiLoader, double money)
 {
     AILoader   = aiLoader;
     Money      = money;
     ScoutCount = 0;
     CarryCount = 0;
     KillCount  = 0;
     DeathCount = 0;
 }
Exemplo n.º 5
0
        public override void OnAwake()
        {
            loader          = Core.ResEng.getLoader <VirtualNpcLoader>();
            mWarPoint       = GameObject.FindGameObjectWithTag("WarServer");
            freshGroupModel = Core.Data.getIModelConfig <FreshGroupModel>();
            freshPoolModel  = Core.Data.getIModelConfig <FreshPoolModel>();
            AiLoader        = Core.ResEng.getLoader <AILoader>();

            myHero  = gameObject.GetComponent <BNPC>();
            curPool = freshPoolModel.GetNPCFreshPool(myHero.dataInScene.freshParam.freshPoolID);

            crtMsg            = new IpcCreateNpcMsg();
            crtMsg.npclist    = new CrtHero[1];
            crtMsg.npclist[0] = new CrtHero();

            hpMsg = new IpcNpcHpMsg();
        }
Exemplo n.º 6
0
    public void Awake()
    {
        instance = this;

        // PL, 28.7.2008, this way we can load the file "fileName" in OSX standalone player,
        // Windows standalone player and Unity Editor.
        string fileNameWithPath = Application.dataPath + "/" + fileName;

        XmlTextReader reader = new XmlTextReader(fileNameWithPath);
        reader.WhitespaceHandling = WhitespaceHandling.None;
        reader.Read();
        XmlDocument document = new XmlDocument();
        document.Load(reader);
        rootElement = (XmlElement)document.GetElementsByTagName("root").Item(0);

        impressions = LoadImpressions(rootElement);
        opinions = LoadOpinions(rootElement, impressions);
    }
Exemplo n.º 7
0
        public FindPathRule()
        {
            BaseGame.ShowMouse = true;

            aiList = new Combo("AIList", new Vector2(200, 200), 300);

            aiList.OnChangeSelection += new EventHandler(AIList_OnChangeSelection);

            aiLoader = new AILoader();
            aiLoader.AddInterAI(typeof(PathFinderThird));
            aiLoader.AddInterAI(typeof(PathFinderSecond));
            aiLoader.AddInterAI(typeof(ManualControl));
            aiLoader.AddInterAI(typeof(PathFinderFirst));
            aiLoader.InitialCompatibleAIs(typeof(IAIOrderServerSinTur), typeof(AICommonServer));
            foreach (string name in aiLoader.GetAIList())
            {
                aiList.AddItem(name);
            }
            btn          = new TextButton("OkBtn", new Vector2(700, 500), "Begin", 0, Color.Blue);
            btn.OnClick += new EventHandler(btn_OnClick);
        }
Exemplo n.º 8
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            AILoader loader = new AILoader();

            loader.SaveToFile(mRules, Name);
        }
Exemplo n.º 9
0
 public StartNewGameFrom(ChessMainForm MainForm)
 {
     this.mainForm = MainForm;
     InitializeComponent();
     this.mainLoader = this.mainForm.GetAILoader();
 }
Exemplo n.º 10
0
        void AttachAI(ServerNPC npc, int ai)
        {
            ServerLifeNpc lifeNpc = npc as ServerLifeNpc;

            if (lifeNpc == null)
            {
                return;
            }
            lifeNpc.data.btData     = new NPCBattleData();
            lifeNpc.data.btData.way = BATTLE_WAY.None;
            AILoader  AiLoader = Core.ResEng.getLoader <AILoader>();
            NPCAIType type     = (NPCAIType)ai;

            switch (type)
            {
            case NPCAIType.Pathfind_Atk:
            {
                BehaviorTree tree = npc.gameObject.GetComponent <BehaviorTree> ();
                if (tree == null)
                {
                    tree = npc.gameObject.AddComponent <BehaviorTree>();
                }

                tree.ExternalBehavior    = AiLoader.load(AILoader.PATHFIND_ATK);
                tree.StartWhenEnabled    = true;
                tree.RestartWhenComplete = true;
                lifeNpc.AutoAiTree       = tree;
            }
            break;

            case NPCAIType.Simple_PfAtk:
            {
                BehaviorTree tree = npc.gameObject.GetComponent <BehaviorTree> ();
                if (tree == null)
                {
                    tree = npc.gameObject.AddComponent <BehaviorTree>();
                }

                tree.ExternalBehavior    = AiLoader.load(AILoader.SIMPLE_PFATK);
                tree.StartWhenEnabled    = true;
                tree.RestartWhenComplete = true;
                lifeNpc.AutoAiTree       = tree;
            }
            break;

            case NPCAIType.Patrol:
            {
                BehaviorTree tree = npc.gameObject.GetComponent <BehaviorTree> ();
                if (tree == null)
                {
                    tree = npc.gameObject.AddComponent <BehaviorTree>();
                }

                tree.ExternalBehavior    = AiLoader.load(AILoader.NORMAL_ATTACK);
                tree.StartWhenEnabled    = true;
                tree.RestartWhenComplete = true;
                lifeNpc.AutoAiTree       = tree;
            }
            break;
            }
        }