public void GetAvailablePositions(HexBattale startingHex, int stepsLimit, IAdjacentFinder AdjFinder) { AdjFinder.GetAdjacentHexesExtended(startingHex); for (step = 2; step <= stepsLimit; step++) { initialHexes = GetNewInitialHexes(); foreach (HexBattale hex in initialHexes) { AdjFinder.GetAdjacentHexesExtended(hex); hex.isIncluded = true; } } }
List <BattleHex> initialHexes = new List <BattleHex>(); //collects neighbouring hexes for evaluated hex public void GetAvailablePositions(int stepsLimit, IAdjacentFinder AdjFinder, IInitialHexes getHexesToCheck)//looks for all positions available { BattleHex startingHex = BattleController.currentAtacker.GetComponentInParent <BattleHex>(); AdjFinder.GetAdjacentHexesExtended(startingHex);//looks for hexes adjacent to starting hex. Flying unit for now //runs iterations to find all positions available. steps=number of iterations for (step = 2; step <= stepsLimit; step++) { initialHexes = getHexesToCheck.GetNewInitialHexes();//collects hexes ready for a new iteration foreach (BattleHex hex in initialHexes) { AdjFinder.GetAdjacentHexesExtended(hex); // defines neighbouring hexes for each hex in the collection hex.isIncluded = true; //defines evaluated hex as available position } } }
List <BattleHex> initialHexes = new List <BattleHex>(); // recopila los hexes vecinos para el hex evaluado public void GetAvailablePositions(int stepsLimit, IAdjacentFinder AdjFinder, IInitialHexes getHexesToCheck)// busca todas las posiciones disponibles { BattleHex startingHex = BattleController.currentAtacker.GetComponentInParent <BattleHex>(); AdjFinder.GetAdjacentHexesExtended(startingHex);// busca hexágonos adyacentes al hex inicial. Unidad voladora por ahora // ejecuta iteraciones para encontrar todas las posiciones disponibles. pasos = número de iteraciones for (step = 2; step <= stepsLimit; step++) { initialHexes = getHexesToCheck.GetNewInitialHexes();// recopila hexágonos listos para una nueva iteración foreach (BattleHex hex in initialHexes) { AdjFinder.GetAdjacentHexesExtended(hex); // define los hexes vecinos para cada hex de la colección hex.isIncluded = true; // define el hexadecimal evaluado como posición disponible } } }
internal void MatchPath() { optimalPath.Clear(); targetHex = BattleController.targetToMove; optimalPath.Add(targetHex); int steps = targetHex.distanceText.distanceFromStartingPosition; for (int i = steps; i > 1;) { AdjacentOption.GetAdjacentHexesExtended(targetHex); targetHex = nextStep; i -= nextStep.distanceText.MakeMePartOfOptimalPath(); } ManagePath(); }
//collects hexes in optimal path list and highlights them internal void MatchPath() { optimalPath.Clear(); //clears the list before re-filling targetHex = BattleController.targetToMove; //first hex included in optimal path optimalPath.Add(targetHex); //defines the distance from target hex int steps = targetHex.distanceText.distanceFromStartingPoint; for (int i = steps; i > 1;) // iterates to find out all hexes to be included in optimal path { AdjacentOption.GetAdjacentHexesExtended(targetHex); //finds out hexes adjacent to targethex targetHex = nextStep; // when the hex is included in list it becomes a new target hex i -= nextStep.distanceText.MakeMePartOfOptimalPath(); // decreases the i variably by stepsToGo value } ManagePath(); }
// recopila hexágonos en la lista de ruta óptima y los resalta internal void MatchPath() { optimalPath.Clear(); // borra la lista antes de volver a llenarla targetHex = BattleController.targetToMove; // primer hexadecimal incluido en la ruta óptima optimalPath.Add(targetHex); // define la distancia desde el hex objetivo int steps = targetHex.distanceText.distanceFromStartingPoint; for (int i = steps; i > 1;) // itera para averiguar todos los hexes que se incluirán en la ruta óptima { AdjacentOption.GetAdjacentHexesExtended(targetHex); // descubre los hexes adyacentes al targethex targetHex = nextStep; // cuando el hexadecimal se incluye en la lista, se convierte en un nuevo hexadecimal objetivo i -= nextStep.distanceText.MakeMePartOfOptimalPath(); // disminuye la i de forma variable por el valor de stepsToGo } ManagePath(); }