Example #1
0
        public Input_AI_Expand(Input_AI input, IBattleField battlefield, CharController_Direct _self, FB.FFSM.AI_StateTable table, AILevel aiLevel)
        {
            this.selfCC      = _self;
            this.battlefield = battlefield;
            this.input       = input;
            this.aiLevel     = aiLevel;
            this.ai_table    = table;
            //ai改变属性
            AILevelChange();

            vIdlePos = (battlefield as BattleField).GetRealChar(selfCC.idCare).transform.position;

            enemyCC = battlefield.GetAllCCBySide(1)[0] as CharController_Direct;
            //enemyCC.SetCCLife(0);
            stateTable = (battlefield as BattleField).GetRealChar(selfCC.idCare).transform.GetComponent <FB.FFSM.com_FightFSM>().stateTable;
            Start();
            ChangeState(StateMachine.idle);

            ai_attackstate_map = new Dictionary <int, List <AI_StateItem> >();
            for (int i = 0; i <= 3; i++)
            {
                ai_attackstate_map[i] = new List <AI_StateItem>();//0 移动系列
            }
            if (ai_table == null || ai_table.allstates == null)
            {
                return;
            }
            foreach (var a in ai_table.allstates)
            {
                ai_attackstate_map[a.attacktype].Add(a);
            }
        }
Example #2
0
        //检测多少队友在攻击
        int CheckAttackNum()
        {
            var cc  = battlefield.GetAllCCBySide(selfCC.idSide);//得到队友
            int num = 0;

            foreach (CharController_Direct c in cc)
            {
                if (c != null && c.joy is Input_AI)
                {
                    if ((c.joy as Input_AI).ai_expand.laststate == StateMachine.attack)
                    {
                        num++;
                    }
                }
            }
            return(num);
        }