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()
        {
            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);
        }