//移动
        private IEnumerator PlayMotionAction(BattleUnitMotionAction action)
        {
            if (action == null)
            {
                UtilityHelper.LogError("Error BattleHeroMotionAction");
                yield break;
            }

            UpdateRenderState(BattleUnitRenderState.Action);
            //手动操作的移动可能没有攻击目标
            if (action.targetUnit != null)
            {
                action.targetUnit.battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Selected);
            }

            //先显示区域
            BattleFieldRenderer.Instance.SetCircularRangeRenderStateActive(
                false,
                GridRenderType.MoveRange);

            //显示路径
            BattleFieldRenderer.Instance.SetGridsRenderStateActive(true, action.gridPath);

            //yield return EGameConstL.WaitForTouchedScreen;

            //移动
            for (int i = 0; i < action.gridPath.Length; ++i)
            {
                UpdatePositionByGrid(action.gridPath[i]);
                yield return(EGameConstL.WaitForDotOneSecond);
            }

            //清空范围和路径
            BattleFieldRenderer.Instance.SetCircularRangeRenderStateActive(false, GridRenderType.MoveRange);

            //显示路径
            BattleFieldRenderer.Instance.SetGridsRenderStateActive(false, null);

            //手动操作的移动可能没有攻击目标
            if (action.targetUnit != null)
            {
                action.targetUnit.battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Normal);
            }

            //TEMP
            if (!battleUnit.battleUnitAttribute.manualOperation)
            {
                UpdateRenderState(BattleUnitRenderState.Normal);
            }
        }
Beispiel #2
0
        //向目标格子移动
        public void MoveToTargetGrid(BattleUnit targetUnit, GridUnit targetGrid, GridUnit[] gridPath)
        {
            BattleUnitMotionAction action = BattleUnitActionEvent.CreateEvent <BattleUnitMotionAction>(BattleUnitActionType.MoveToTarget, this);

            action.targetUnit = targetUnit;
            action.fromGrid   = mapGrid;
            action.gridPath   = gridPath;
            action.moveRange  = battleUnitAttribute.mobility;

            battleField.AppendBattleAction(action);

            //进入格子,直接设置数据
            EnterGrid(targetGrid);
        }