// 第二步 技能计算范围显示 protected void SkillTriggerClick(Vector3Int _cellPos) { if (cacheUnit.currentPos.Vector3IntRangeValue(_cellPos) <= cacheUnit.moveRangeValue[0]) { skillPos = _cellPos; TileSaveData[] tileData = tileMapManager.GetRoundTileSaveData(_cellPos, cacheUnit.skillRangeValue[0]); tileMapManager.ShowCustomActionGrid(tileData); cursor.AddStepEvent(cacheUnit, tileData, ActionScopeType.AllUnit, null, SkillTriggerSureClick, () => { }); } }
// 第一步 技能施法范围显示 public override void StartCommand(ActivitiesUnit _unit, GameCursor _cursor, SceneTileMapManager _tileMapManager) { cacheUnit = _unit; cursor = _cursor; tileMapManager = _tileMapManager; TileSaveData[] tileData = _tileMapManager.GetRoundTileSaveData(_unit.currentPos, _unit.skillRangeValue[0] + skillIncrement); _tileMapManager.ShowCustomActionGrid(tileData); _cursor.AddStepEvent(_unit, tileData, ActionScopeType.AllUnit, null, SkillTriggerClick, () => { }); }
/// <summary> /// 显示可移动相关区域 /// </summary> public async void ShowCanMoveCorrelationGrid(ActivitiesUnit _unit, bool _isAsync) { // 问题出在这了,底下的方格还没显示完就注册了。 cursor.AddStepEvent(_unit, cacheSaveData, ActionScopeType.NoActivitiesUnit, null, activitiesManager.ClickTilePos, () => { asyncBoolValue = false; }); asyncBoolValue = true; foreach (var v in tileList.Where(x => x.activitiesAllowUnit.moveSpriteRenderer.enabled == false)) { v.activitiesAllowUnit.SetMoveGrid(true); } int ms = 30; int moveValue = _unit.moveRangeValue[0]; for (int i = 0; i <= moveValue; i++) { if (cacheSaveData == null || !asyncBoolValue) { return; } foreach (var v in cacheSaveData.Where( x => x.widthHeighValue.Vector3IntRangeValue(_unit.currentPos) == i)) { v.activitiesAllowUnit.SetMoveGrid(false); } if (_isAsync) { await Task.Delay(ms); } } asyncBoolValue = false; }