Пример #1
0
 public float evaluate(Tile tile,Unit unit)
 {
     float value = 0f;
         value += positionValue(tile,unit);
         value += attackValue(tile,unit);
     return value;
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 public override void rightClickedTile(Tile tile)
 {
     //input from user
     if(Grid.map.getAllVisibleTiles().Contains (tile)){
         activate(tile);
     }
 }
Пример #4
0
 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");
 }
Пример #5
0
 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");
     }
 }
Пример #6
0
 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");
     }
 }
Пример #7
0
 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;
 }
Пример #8
0
 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();
 }
Пример #9
0
 public abstract void rightClickedTile(Tile tile);
Пример #10
0
 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;
 }
Пример #11
0
 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();
 }
Пример #12
0
 public override void clickedTile(Tile tile)
 {
     //input from user
     Grid.controller.endAction("cancel");
 }
Пример #13
0
 public override void rightClickedTile(Tile tile)
 {
     //input from user
 }
Пример #14
0
        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;
            }*/
        }
Пример #15
0
 public abstract void clickedTile(Tile tile);
Пример #16
0
 public override void activate(Tile tile)
 {
 }
Пример #17
0
 //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;
 }
Пример #18
0
 //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;
 }
Пример #19
0
 public override void clickedTile(Tile tile)
 {
 }
Пример #20
0
 public override void rightClickedTile(Tile tile)
 {
 }
Пример #21
0
 public abstract void activate(Tile tile);