public float evaluate(Tile tile,Unit unit) { float value = 0f; value += positionValue(tile,unit); value += attackValue(tile,unit); return value; }
public override void rightClickedTile(Tile tile) { //input from user if(Grid.map.getTilesInRange(unit.tile.x,unit.tile.y,TileCosts.Flat,minRnge,maxRnge).Contains (tile)){ activate(tile); } }
public override void rightClickedTile(Tile tile) { //input from user if(Grid.map.getAllVisibleTiles().Contains (tile)){ activate(tile); } }
public override void clickedTile(Tile tile) { //input from user foreach(Tile shaded in Grid.map.getAllVisibleTiles()){ shaded.highlight(Highlight.CLEAR); } Grid.controller.endAction("cancel Spell"); }
public override void activate(Tile tile) { //does the action unit.mov = 0; if (unit.faction.Equals(Grid.turnManager.factions[0])){ //if it was the player's unit. unit.deleteActionsMenu(); unit.refreshVision(); Grid.controller.endAction("finish"); } }
public override void activate(Tile tile) { //does the action if (tile.hasUnit() && !tile.unit.faction.Equals(unit.faction)) Controller.battle (unit,tile.unit); else return; unit.mov = 0; if (unit.faction.Equals(Grid.turnManager.factions[0])){ //if it was the player's unit. unit.deleteActionsMenu(); unit.refreshVision(); Grid.controller.endAction("finish"); } }
public override void activate(Tile tile) { //does the action Faction player = Grid.turnManager.active; if (tile.hasUnit() && !tile.unit.faction.Equals(player)){ tile.unit.takeRawDamage(1); foreach(Tile shaded in Grid.map.getAllVisibleTiles()){ shaded.highlight(Highlight.CLEAR); } Grid.controller.endAction("finish"); } else return; }
public override void initiate() { //makeUnit(0,0); //makeUnit(Map.HEIGHT-1,Map.HEIGHT -1); //makeUnit (Map.HEIGHT-1,0); //makeUnit (0,Map.HEIGHT-1); playerStart = Grid.map.map[Map.WIDTH/2,Map.WIDTH/2]; distanceToPlayer = Grid.map.findOptions(playerStart.x,playerStart.y,0); //distanceToPlayer.printMap(); foreach (Tile tile in distanceToPlayer.furthestTiles){ makeBuilding(new AIBaseBuilding(tile.x,tile.y,this)); //BuildingEffect.activateWith(buildings,"MakeUnit","basic"); break; //makeUnit(tile.x,tile.y); } Grid.map.makeAllFog(); }
public abstract void rightClickedTile(Tile tile);
private float attackValue(Tile tile, Unit unit) { float value = 0f; List<Tile> tiles = Grid.map.getTilesInMovement(tile.x,tile.y,TileCosts.Flat,unit.maxRnge); foreach(Tile otherTile in tiles){ if (otherTile.hasUnit() && !otherTile.unit.faction.Equals(this)) value = 1f*ATTACKWEIGHT; //this should be more detailed later. } return value; }
public override void activate(Tile tile) { //termination of the phase is handled by the skillOption button. //activated is also marked as true there. selected = pickRandomSkill(); }
public override void clickedTile(Tile tile) { //input from user Grid.controller.endAction("cancel"); }
public override void rightClickedTile(Tile tile) { //input from user }
public override void rightClickedTile(Tile tile) { if (!selectedTiles.Contains(tile)) return; //do nothing if the tile does not support the type of building. build.makeBuilding(tile.x,tile.y); Faction player = Grid.turnManager.player; //make the code shorter by assigning this player.makeBuilding(build); end (); /* switch (type){ case "Citadel": player.makeBuilding(new Citadel(tile.x,tile.y)); break; default: MonoBehaviour.print ("no buildings match that name"); break; }*/ }
public abstract void clickedTile(Tile tile);
public override void activate(Tile tile) { }
//takes a tile as the start point and a unit and returns all the enemy units in that units range private List<Unit> getUnitsInRange(Tile tile, Unit unit) { List<Unit> units = new List<Unit>(); List<Tile> tiles = Grid.map.getTilesInMovement(tile.x,tile.y,TileCosts.Flat,unit.maxRnge); foreach(Tile otherTile in tiles){ if (otherTile.hasUnit() && otherTile.unit.faction != this) units.Add(otherTile.unit); //this should be more detailed later. } return units; }
//how close to the center is it. private float positionValue(Tile tile,Unit unit) { float value = 0f; value += (float) (Map.HEIGHT + Map.WIDTH - distanceToPlayer.get(tile.x,tile.y));//Grid.map.searchForTile(tile.x,tile.y,playerStart,0,unit.moveCosts); value *= POSITIONWEIGHT; return value; }
public override void clickedTile(Tile tile) { }
public override void rightClickedTile(Tile tile) { }
public abstract void activate(Tile tile);