/// <summary> /// 一番早いパスを選択 /// </summary> /// <param name="pathList"></param> /// <returns></returns> private MapTilePathInfo ChoiceFastPath(List <string> pathList) { List <MapTilePathInfo> pathInfoList = new List <MapTilePathInfo>(); foreach (string path in pathList) { MapTilePathInfo pathInfo = new MapTilePathInfo(path); pathInfoList.Add(pathInfo); } // ソート IOrderedEnumerable <MapTilePathInfo> sortedList = pathInfoList.OrderByDescending(pathInfo => pathInfo.RestMoveCount).ThenBy(pathInfo => pathInfo.Path.Length); List <MapTilePathInfo> retList = new List <MapTilePathInfo>(sortedList); return(retList[0]); }
/// <summary> /// 確認ステータスを設定 /// </summary> /// <param name="fastPath"></param> private void SetConfirmStatus(MapTilePathInfo fastPath) { // ステータスを設定 BattleMapMoveStatus moveStatus = holder.BattleMapStatus.BattleMapMoveStatus; moveStatus.BattleMapMoveStatusType = BattleMapMoveStatusType.MOVE_CONFIRM; // パス情報をタイルに変換 List <BattleMapTile> list = new List <BattleMapTile>(); foreach (string path in fastPath.Path) { string[] xy = path.Split(','); BattleMapTile bmt = holder.BattleMap.BattleMapTiles[int.Parse(xy[0]), int.Parse(xy[1])]; list.Add(bmt); } // 反転させる list.Reverse(); moveStatus.MapTilePathList = list; }
/// <summary> /// 移動確認 /// </summary> /// <param name="bmt"></param> public void ConfirmMove(BattleMapTile bmt) { // 今あるパスを削除 ClearPath(); // パスのリストを作成 List <string> pathList = CreatePathList(bmt); string tmp = ""; foreach (string path in pathList) { tmp += path + "\n"; } // 一番早いパスを取得 MapTilePathInfo fastPath = ChoiceFastPath(pathList); // ステータスを更新 SetConfirmStatus(fastPath); // パスを描画 DrawPath(); }