//移动 private IEnumerator PlayMotionAction(BattleHeroMotionAction 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( true, GridRenderType.MoveRange, action.fromGrid.row, action.fromGrid.column, action.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.manual) { UpdateRenderState(BattleUnitRenderState.Normal); } }
//向目标格子移动 public void MoveToTargetGrid(List <BattleAction> actions, BattleUnit targetUnit, GridUnit targetGrid, GridUnit[] gridPath) { if (actions != null) { BattleHeroMotionAction action = new BattleHeroMotionAction(this); action.targetUnit = targetUnit; action.fromGrid = mapGrid; action.toGrid = targetGrid; action.gridPath = gridPath; action.moveRange = mobility; actions.Add(action); } EnterGrid(targetGrid); }
//向目标格子移动 private void MoveToTargetGrid(List <BattleAction> actions) { if (actions != null) { BattleHeroMotionAction action = new BattleHeroMotionAction(this); action.targetUnit = targetBattleUnit; action.fromGrid = this.mapGrid; action.toGrid = targetGrid; action.gridPath = toTargetPath.ToArray(); action.moveRange = this.mobility; actions.Add(action); } EnterGrid(targetGrid); }
//移动 private IEnumerator PlayMotionAction(BattleHeroMotionAction action) { if (action == null) { UtilityHelper.LogError("Error BattleHeroMotionAction"); yield break; } AddBattleBeSelected(this, EGameConstL.Color_Cyan); //手动操作的移动可能没有攻击目标 if (action.targetUnit != null) { AddBattleBeSelected(action.targetUnit.battleUnitRenderer, EGameConstL.Color_Yellow); } //先显示区域 BattleFieldRenderer.Instance.SetRangeHighlightActive(true, action.fromGrid.row, action.fromGrid.column, action.moveRange); //显示路径 BattleFieldRenderer.Instance.SetPathHighlightActive(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.SetRangeHighlightActive(false, 0, 0, 0); //显示路径 BattleFieldRenderer.Instance.SetPathHighlightActive(false, null); ClearAllSelectedBattleUnit(); }
//移动 private IEnumerator PlayMotionAction(BattleHeroMotionAction action) { if (action == null) { UtilityHelper.LogError("Error BattleHeroMotionAction"); yield break; } AddBattleBeSelected(this, EGameConstL.Color_Cyan); AddBattleBeSelected(action.targetUnit.battleUnitRenderer, EGameConstL.Color_Yellow); //先显示区域 UtilityObjs.gridUnits.Clear(); battleUnit.battleField.battleMap.GetRangeGrids(action.fromGrid.row, action.fromGrid.column, action.moveRange, UtilityObjs.gridUnits); for (int i = 0; i < UtilityObjs.gridUnits.Count; ++i) { if (UtilityObjs.gridUnits[i].GridType == GridType.Obstacle) { continue; } if (UtilityObjs.gridUnits[i].gridUnitRenderer != null) { UtilityObjs.gridUnits[i].gridUnitRenderer.GridRenderType = GridRenderType.Range; } } //显示路径 for (int i = 0; i < action.gridPath.Length; ++i) { if (action.gridPath[i].gridUnitRenderer) { action.gridPath[i].gridUnitRenderer.GridRenderType = GridRenderType.Path; } } //yield return EGameConstL.WaitForTouchedScreen; //移动 for (int i = 0; i < action.gridPath.Length; ++i) { UpdatePositionByGrid(action.gridPath[i]); yield return(EGameConstL.WaitForDotOneSecond); } //清空范围和路径 for (int i = 0; i < UtilityObjs.gridUnits.Count; ++i) { if (UtilityObjs.gridUnits[i].GridType == GridType.Obstacle) { continue; } if (UtilityObjs.gridUnits[i].gridUnitRenderer != null) { UtilityObjs.gridUnits[i].gridUnitRenderer.GridRenderType = GridRenderType.Normal; } } for (int i = 0; i < action.gridPath.Length; ++i) { if (action.gridPath[i].gridUnitRenderer) { action.gridPath[i].gridUnitRenderer.GridRenderType = GridRenderType.Normal; } } ClearAllSelectedBattleUnit(); }