/// <summary> /// 当左键按下时,Move类型的活动 /// </summary> /// <param name="selectedCell"></param> /// <returns></returns> public List <CellData> ShowMoveRangeCells(CellData selectedCell) { List <CellData> cells; //if (m_CursorCells.Count == 0 || !m_CursorCells.Contains(selectedCell)) if (!selectedCell.hasMoveCursor) { if (m_DebugInfo) { Debug.LogFormat("MoveRange: start {0}, move point {1}, status ({2})", selectedCell.position.ToString(), m_MovePoint.ToString(), selectedCell.GetStatus().ToString()); } ClearTestCursors(); //m_CursorCells.Clear(); m_TestClass.UpdatePosition(selectedCell.position); cells = m_Map.SearchMoveRange(selectedCell, m_MovePoint, m_MoveConsumption); //m_CursorCells.AddRange(cells); CreateTestCursors(cells, false); if (m_PathfindingType == TestPathfindingType.MoveAndAttack) { // 移动范围后,进行查找攻击范围 HashSet <CellData> attackCells = new HashSet <CellData>(); foreach (var cell in cells.ToArray()) { //foreach (var c in m_Map.SearchAttackRange(cell, m_AttackRange.x, m_AttackRange.y, true)) //{ // //if (!cells.Contains(c) && !attackCells.Contains(c)) // if (!c.hasCursor) // { // attackCells.Add(c); // } //} attackCells.UnionWith( m_Map.SearchAttackRange(cell, m_AttackRange.x, m_AttackRange.y, true) .Where(c => !c.hasCursor)); } CreateTestCursors(attackCells, true); } } else { if (m_DebugInfo) { Debug.LogFormat("Selected end {0} status ({1})", selectedCell.position, selectedCell.GetStatus().ToString()); } ClearTestCursors(); //m_CursorCells.Clear(); Stack <CellData> pathCells = m_Map.searchPath.BuildPath(selectedCell); cells = new List <CellData>(pathCells); m_TestClass.animatorController.PlayMove(); m_TestClass.StartMove(pathCells); CreateTestCursors(cells, false); } return(cells); }