private MovementPath getPath(Map Map, List <int> pathCell) { pathCell.Reverse(); MovementPath Path = new MovementPath(); int current = 0; int child = 0; int PMUsed = 0; if (pathCell.Count > 1) { Path.AddCell(pathCell[0], Pathfinder.GetDirection(Map, pathCell[0], pathCell[1])); } for (int i = 0; i <= pathCell.Count - 2; i++) { PMUsed++; if ((PMUsed > nombreDePM)) { Path.MovementLength = nombreDePM; return(Path); } current = pathCell[i]; child = pathCell[i + 1]; Path.AddCell(child, Pathfinder.GetDirection(Map, current, child)); } Path.MovementLength = PMUsed; return(Path); }
public static List <int> GetCells(Map Map, int Cell, int CurrentCell, string Range) { switch (Range[0]) { case 'C': return(GetCircleCells(Map, Cell, MapCrypter.HASH.IndexOf(Range[1]))); case 'X': return(GetCrossCells(Map, Cell, MapCrypter.HASH.IndexOf(Range[1]))); case 'T': var Cells1 = new List <int> { Cell }; Cells1.AddRange(GetTLineCells(Map, Cell, Pathfinder.GetDirection(Map, CurrentCell, Cell), MapCrypter.HASH.IndexOf(Range[1]))); return(Cells1); case 'L': var Cells2 = new List <int> { Cell }; Cells2.AddRange(GetLineCells(Map, Cell, Pathfinder.GetDirection(Map, CurrentCell, Cell), MapCrypter.HASH.IndexOf(Range[1]))); return(Cells2); } return(new List <int>() { Cell }); }
public static string CreateStringPath(int baseCell, int baseDir, List <int> cells, Map map) { string path = GetDirChar(baseDir) + GetCellChars(baseCell); foreach (int cell in cells) { path += GetDirChar(Pathfinder.GetDirection(map, baseCell, cell)) + GetCellChars(cell); baseCell = cell; } return(path); }
public static bool CellsInSameLineFight(Map Map, int BeginCell, int EndCell, int BaseDirection) { int BaseDirectionOpp = Pathfinder.OppositeDirection(BaseDirection); int dir = Pathfinder.GetDirection(Map, BeginCell, EndCell); if (dir > 3) { Logger.Info("Dir > 3!!"); return(false); } return(dir == BaseDirection || dir == BaseDirectionOpp); }