IEvaluateHex checkHex = new IfItIsNewFlying();// consulte la interfaz para acceder al comportamiento que necesitamos // individualiza la búsqueda de puestos para un regimiento de vuelo public void GetAdjacentHexesExtended(BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { hex.isNeighboringHex = true;// define el hexadecimal como adyacente al hexadecimal inicial evaluado hex.distanceText.SetDistanceForFlyingUnit(initialHex); hex.MakeMeAvailable(); } }
public void GetAdjacentHexesExtended(HexBattale initialHex) { List <HexBattale> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, chcekHex); foreach (HexBattale hex in neighboursToCheck) { hex.isNeighboringHex = true; hex.distanceText.SetDistanceFromStartingHex(initialHex); hex.MakeMeAviable(); } }
IEvaluateHex checkHex = new IfItIsNewFlying();//refer to interface to access the behavior we need //individualizes the search for positions for a flying regiments public void GetAdjacentHexesExtended(BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { hex.isNeighboringHex = true;//defines the hex as adjacent to evaluted initial hex hex.distanceText.SetDistanceForFlyingUnit(initialHex); hex.MakeMeAvailable(); } }
public void GetAdjacentHexesExtended(BattleHex initialHex) { List <BattleHex> neighboursToCkeck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCkeck) { hex.isNeighbourgHex = true; hex.distanceText.SetDistanceFofFlyingUnit(initialHex); hex.MakeAvailable(); } }
public void GetAdjacentHexesExtended(BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { if (hex.distanceText.EvaluateDistance(initialHex)) { OptimalPath.nextStep = hex; break; } } }
IEvaluateHex checkHex = new IfItIsNewGroundAI();//refer to interface to access the behavior we need public void GetAdjacentHexesExtended(BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { if (hex.distanceText.EvaluateDistanceForGround(initialHex)) { hex.isNeighboringHex = true;//defines the hex as adjacent to evaluted initial hex hex.distanceText.SetDistanceForGroundUnit(initialHex); } } }
public void FindAlive_ReturnsEmpty_ForAllDead() { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(0); }
public void GetAdjacentHexesExtended(HexBattale initialHex) { List <HexBattale> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (HexBattale hex in neighboursToCheck) { //compare distances between two hexes if (hex.distanceText.EvaluateDistance(initialHex)) { OptimalPath.nextStep = hex; break; } } }
public void GetAdjacentHexesExtended(int stepsLimit, BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { //Compares the current value of the distanceFromStarting point variable with a new value if (hex.distanceText.EvaluateDistanceForGroundAI(initialHex, stepsLimit)) { hex.isNeighboringHex = true; hex.distanceText.SetDistanceForGroundUnit(initialHex);//sets the distance from the starting hex } } }
public void GetAdjacentHexesExtended(int stepsLimit, BattleHex initialHex) { List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { // Compara el valor actual de la variable del punto distanceFromStarting con un nuevo valor if (hex.distanceText.EvaluateDistanceForGroundAI(initialHex, stepsLimit)) { hex.isNeighboringHex = true; hex.distanceText.SetDistanceForGroundUnit(initialHex);// establece la distancia desde el hex de inicio } } }
IEvaluateHex checkHex = new IfItIsTargetRange();// para acceder al comportamiento que necesitamos public void GetAdjacentHexesExtended(BattleHex initialHex) { // recolecta hexes que cumplen con los criterios definidos por la regla IfItIsTargetRange List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { hex.lookingForTarget = true;// define el hexadecimal como adyacente al hexadecimal evaluado if (hex.GetComponentInChildren <Enemy>() != null) { hex.DefineMeAsPotencialTarget();// marca hexadecimal como un objetivo potencial } } }
IEvaluateHex checkHex = new IfItIsTargetRange();// to access the behavior we need public void GetAdjacentHexesExtended(BattleHex initialHex) { //collect hexes that meet the criteria defined by the IfItIsTargetRange rule List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { hex.lookingForTarget = true;//defines the hex as adjacent to evaluted hex if (hex.GetComponentInChildren <Enemy>() != null) { hex.DefineMeAsPotencialTarget();//marks hex as a potential target } } }
IEvaluateHex checkHex = new IfItIsOptimalPath();//select option to find out the optimal path public void GetAdjacentHexesExtended(BattleHex initialHex) { //collect hexes to select new link of optimal path chain List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { //compare distances between two hexes if (hex.distanceText.EvaluateDistance(initialHex)) { OptimalPath.nextStep = hex; //save the hex included in optimal path break; //since we have to stop looking for other hexes } } }
IEvaluateHex checkHex = new IfItIsOptimalPath();// seleccione la opción para encontrar la ruta óptima public void GetAdjacentHexesExtended(BattleHex initialHex) { // recolecta hexes para seleccionar un nuevo enlace de la cadena de ruta óptima List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); foreach (BattleHex hex in neighboursToCheck) { // comparar distancias entre dos hexes if (hex.distanceText.EvaluateDistance(initialHex)) { OptimalPath.nextStep = hex; // guarda el hexadecimal incluido en la ruta óptima break; // ya que tenemos que dejar de buscar otros maleficios } } }
public override void DefineTargets() { BattleHex initialHex = GetComponentInParent <BattleHex>(); // hex ocupado por el troll IEvaluateHex checkHex = new IfItIsTarget(); // regla de validación de hexes vecinos // recopilar objetivos potenciales List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); if (neighboursToCheck.Count > 0) // si hay un objetivo en el hex adyacente { HeroIsAtacking(); // ataca al objetivo } else { turn.TurnIsCompleted(); } // se completa el turno }
public override void DefineTargets() { BattleHex initialHex = GetComponentInParent <BattleHex>(); //hex occupied by the troll IEvaluateHex checkHex = new IfItIsTarget(); //neighboring hexes validation rule //collect potencial targets List <BattleHex> neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); if (neighboursToCheck.Count > 0) //if there is a target on the adjacent hex { HeroIsAtacking(); //attacks the target } else { turn.TurnIsCompleted(); } //turn is completed }
// si el enemigo está cerca, márcalo y deja de buscar enemigos distantes bool TargetsNearby(Hero currentAtacker) { bool targetNearby = false; // la variable te permite saber si hay un enemigo cerca initialHex = currentAtacker.GetComponentInParent <BattleHex>(); // hexagonos inicial // recolecta hexágonos vecinos neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); if (neighboursToCheck.Count > 0)// comprobar si la lista no está vacía { foreach (BattleHex hex in neighboursToCheck) { hex.DefineMeAsPotencialTarget();// marcar el objetivo potencial //hex.lookingForTarget = true; } targetNearby = true; } return(targetNearby); }
public void DefineTargets(Hero currentAtacker) { initialHex = currentAtacker.GetComponentInParent <BattleHex>(); // recolectar tergets potenciales neighboursToCheck = NeighboursFinder.GetAdjacentHexes(initialHex, checkHex); int currentAttackerVelocity = BattleController.currentAtacker.heroData.CurrentVelocity; if (neighboursToCheck.Count > 0) { foreach (BattleHex hex in neighboursToCheck) { hex.DefineMeAsPotencialTarget();// marcar el objetivo potencial } } else if (neighboursToCheck.Count == 0 && currentAttackerVelocity == 0) { turn = FindObjectOfType <Turn>(); turn.TurnIsCompleted(); } }
public void FindAlive_ReturnsOne_ForOnlyOneIsAlive(int row, int column) { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); var cells = new Cells(); cells.SetStatus(column, Cell.Status.Alive); rows.Add(row, cells); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(1); }
public void FindAlive_ReturnsTwo_ForTwoAreAlive() { // Arrange Dictionary <int, ICells> rows = CreateEmptyRows(); var cells = new Cells(); cells.SetStatus(0, Cell.Status.Alive); cells.SetStatus(-1, Cell.Status.Alive); rows.Add(-1, cells); NeighboursFinder sut = CreateSut(); // Act int actual = sut.NumberOfAliveNeighbours(rows, 0, 0); // Assert actual.ShouldEqual(2); }