Exemple #1
0
        //自动
        private HeroActionState AutoAction(BattleUnitAction battleUnitAction)
        {
            BattleBehaviourSystem.BattleDecision decision = battleBehaviourSystem.Think();

            if (decision == null)
            {
                battleUnitAction.warningAction            = BattleUnitWarningAction.Get();
                battleUnitAction.warningAction.logWarning = "No target:" + ID;
                return(HeroActionState.Normal);
            }

            //判断是否切换目标
            if (decision.targetBattleUnit != null && !decision.targetBattleUnit.Equals(targetBattleUnit))
            {
                battleUnitAction.changeTargetAction = BattleUnitChangeTargetAction.Get();
                battleUnitAction.changeTargetAction.lastTargetUnit = targetBattleUnit;
                battleUnitAction.changeTargetAction.newTargetUnit  = decision.targetBattleUnit;
                targetBattleUnit = decision.targetBattleUnit;
            }

            //需要移动
            if (decision.movePath != null && decision.movePath.Length > 0)
            {
                MoveToTargetGrid(battleUnitAction, targetBattleUnit, decision.movePath[decision.movePath.Length - 1], decision.movePath);
            }

            //自动搓招儿
            AutoUseSkill(battleUnitAction, decision);

            return(HeroActionState.Normal);
        }
Exemple #2
0
        //自动
        private HeroActionState AutoAction(BattleUnitAction battleUnitAction)
        {
            //自动选择目标
            AutoSelectTarget(battleUnitAction);

            //找不到目标单位,这个就很奇怪了...
            if (targetBattleUnit == null && battleUnitAction != null)
            {
                battleUnitAction.warningAction            = BattleUnitWarningAction.Get();
                battleUnitAction.warningAction.logWarning = "No target:" + battleUnitID;
                return(HeroActionState.Warn);
            }

            //需要移动
            if (battleUnitAction != null && toTargetPath.Count > 0)
            {
                MoveToTargetGrid(battleUnitAction, targetBattleUnit, toTargetPath[toTargetPath.Count - 1], toTargetPath.ToArray());
            }

            //自动搓招儿
            AutoUseSkill(battleUnitAction);

            //战斗结束判断
            if (battleField.CheckBattleEnd())
            {
                return(HeroActionState.BattleEnd);
            }
            else
            {
                return(HeroActionState.Normal);
            }
        }
Exemple #3
0
        //自动
        private HeroActionState AutoAction()
        {
            BattleBehaviourSystem.BattleDecision decision = battleBehaviourSystem.Think();

            if (decision == null)
            {
                BattleUnitWarningAction warningAction = BattleUnitActionEvent.CreateEvent <BattleUnitWarningAction>(BattleUnitActionType.Warning, this);
                battleField.AppendBattleAction(warningAction);
                warningAction.warningLog = "No target:" + ID;
                return(HeroActionState.Normal);
            }

            //判断是否切换目标
            if (decision.targetBattleUnit != null && !decision.targetBattleUnit.Equals(targetBattleUnit))
            {
                BattleUnitChangeTargetAction action = BattleUnitActionEvent.CreateEvent <BattleUnitChangeTargetAction>(BattleUnitActionType.ChangeTarget, this);
                action.lastTargetUnit = targetBattleUnit;
                action.newTargetUnit  = decision.targetBattleUnit;
                battleField.AppendBattleAction(action);

                targetBattleUnit = decision.targetBattleUnit;
            }

            //需要移动
            if (decision.movePath != null && decision.movePath.Length > 0)
            {
                MoveToTargetGrid(targetBattleUnit, decision.movePath[decision.movePath.Length - 1], decision.movePath);
            }

            //自动搓招儿
            AutoUseSkill(decision);

            return(HeroActionState.Normal);
        }