예제 #1
0
        public static int GetCheckSkillDis(eAILevel level)
        {
            switch (level)
            {
            case eAILevel.NEWBIE:
                return(NEWBIE_CHECK_SKILL_DIS);

            case eAILevel.EASY:
                return(EASY_CHECK_SKILL_DIS);

            case eAILevel.NORMAL:
                return(NORMAL_CHECK_SKILL_DIS);

            case eAILevel.HARD:
                return(HARD_CHECK_SKILL_DIS);
            }
            return(EASY_CHECK_SKILL_DIS);
        }
예제 #2
0
파일: CCreatureAI.cs 프로젝트: mengtest/fs
        public CCreatureAI(CCreature creature, eAILevel level = eAILevel.HARD, bool bPatrol = true)
        {
            //if(creature.IsMaster())
            //{
            //    m_list = GameObject.Find("ai_list").AddComponent<UISuperList>();
            //    m_list.Init(300, 60, 1, 5);
            //}
            m_player = creature;
            m_level  = level;
            InitComboData();

            //m_aiObject = new GameObject("ai_" + creature.GetUid());
            m_tree        = new BtTree();
            m_tree.m_root = new BtPrioritySelector();
            m_tree.Init();
            m_tree.m_dataBase.SetData <CCreature>((int)eAIParam.INT_ROLE_UID, creature);
            AIParam.Init(m_tree.m_dataBase);


            // skill level up
            //Condi_SkillUp c_skillUp = new Condi_SkillUp();
            //Action_SkillUp a_skillUp = new Action_SkillUp();
            //BtSequence skillUp = new BtSequence(c_skillUp);
            //skillUp.AddChild(a_skillUp);
            //skillUp.name = "升级中";

            //Condi_CheckTransmit c_checkTransmit = new Condi_CheckTransmit();
            //Action_Transmit a_trans = new Action_Transmit();
            //BtSequence transmit = new BtSequence(c_checkTransmit);
            //transmit.AddChild(a_trans);
            //transmit.name = "瞬间传送";

            // Elude skill
            Condi_CheckSendSkill_ c_checkSkill = new Condi_CheckSendSkill_();
            Action_EludePos_      a_eludePos   = new Action_EludePos_();
            BtSequence            eludeSkill   = new BtSequence(c_checkSkill);

            eludeSkill.AddChild(a_eludePos);
            eludeSkill.name = "躲技能";


            // find buff
            Condi_FindMapBuff_ c_find   = new Condi_FindMapBuff_();
            Action_MoveToBuff_ a_move   = new Action_MoveToBuff_();
            BtSequence         findBuff = new BtSequence(c_find);

            findBuff.AddChild(a_move);
            findBuff.name = "寻找中";

            // fight
            AICondi[] c_fight = new AICondi[3];
            c_fight[0] = new Condi_FindTarget();        // 先通过仇恨,位置获取目标
            c_fight[1] = new Condi_CheckState();        // 再检查自身施法条件是否满足
            c_fight[2] = new Condi_SelectSkill();
            Condi_List findTarget = new Condi_List(c_fight);
            // fight action
            BtSequence          fight        = new BtSequence(findTarget);
            Action_MoveToTarget a_fight_move = new Action_MoveToTarget();
            Action_SendSkill_   a_fight_send = new Action_SendSkill_();

            fight.AddChild(a_fight_move);
            fight.AddChild(a_fight_send);
            fight.name = "战斗中";
            // chase
            Condi_CheckChase c_chase = new Condi_CheckChase();
            Action_Chase     a_chase = new Action_Chase();
            BtSequence       chase   = new BtSequence(c_chase);

            chase.AddChild(a_chase);
            chase.name = "追逐";


            //Condi_CheckFollow c_checkFollow = new Condi_CheckFollow();
            //Action_Follow a_follow = new Action_Follow();
            //BtSequence follow = new BtSequence(c_checkFollow);
            //follow.AddChild(a_follow);
            //follow.name = "跟随";

            // patrol
            Action_Patrol patrol = new Action_Patrol();

            patrol.name = "巡逻中";


            //if (creature.IsPartner())
            //{
            //    m_tree.m_root.AddChild(transmit);
            //}
            //if (creature.IsMaster())
            //{
            //    m_tree.m_root.AddChild(findBuff);
            //}
            m_tree.m_root.AddChild(fight);
            //m_tree.m_root.AddChild(chase);

            //if (creature.IsPartner())
            //{
            //    m_tree.m_root.AddChild(follow);
            //}


            m_tree.m_root.AddChild(patrol);


            m_tree.OnStart();
        }