private CombatLocation getLocation(Player player, String coordsAsString) { int i = 0; int j = 0; try { String[] coords = coordsAsString.Split(','); if (coords.Length != 2) { return(null); } i = Convert.ToInt16(coords[0]); j = Convert.ToInt16(coords[1]); } catch (Exception ex) { return(null); } CombatLocation endLocation = new CombatLocation(player.Location.board, i, j, player.Location.direction); return(endLocation); }
public void startLevel(Party party, int level) { this.level = level; // TO DO: Need to do this in XML // Set the main player location and add them to the board Player mainPlayer = party.getMainPlayer(); CombatLocation location = new CombatLocation(this.board, 9, 9, AnimationKey.NorthEast); mainPlayer.Location = location; board.addGameEntity(mainPlayer); Player soldier = party.getHumanByReferenceName("soldier"); location = new CombatLocation(this.board, 9, 2, AnimationKey.NorthEast); soldier.Location = location; board.addGameEntity(soldier); this.turnBased.startLevel(level); this.screen.startLevel(level); try { combatTheme = lhg.Content.Load <Song>("Audio/combat theme_1"); MediaPlayer.Play(combatTheme); MediaPlayer.IsRepeating = true; } catch { } }
public List <Hex> getHexPath(Player player, Point point) { List <Hex> hexPath = null; CombatLocation startLocation = player.Location; HexBoard hexBoard = startLocation.board.MyHexBoard; Hex startHex = hexBoard.getHex(startLocation.i, startLocation.j); Hex endHex = hexBoard.FindHexMouseClick(point); if (startHex != null && endHex != null) { hexPath = startLocation.board.findPath(startHex, endHex); } return(hexPath); }
public int movePlayer(Player player, Point mousePoint, AnimationCallback callback) { Hex endHex = player.MyBoard.findHexAt(mousePoint); if (endHex != null) { // Make sure the hex that the user clicked on is an allowable move //if (hexBoard.BoardState.isCellSelected(endHex)) { CombatLocation endLocation = new CombatLocation(player.Location.board, endHex.I, endHex.J, player.Location.direction); return(movePlayer(player, endLocation, callback)); } } return(0); }
public int movePlayer(Player player, CombatLocation endLocation, int numCellsToMove, AnimationCallback callback) { CombatLocation startLocation = player.Location; Hex startHex = hexBoard.getHex(startLocation.i, startLocation.j); if (startHex != null) { Hex endHex = hexBoard.getHex(endLocation.i, endLocation.j); if (endHex != null) { // Only move the player the number of action points they have return(movePlayer(player, startHex, endHex, numCellsToMove, callback)); } } return(0); }
public int movePlayer(Player player, CombatLocation endLocation, AnimationCallback callback) { int numHexesMoved = 0; CombatLocation startLocation = player.Location; HexBoard hexBoard = startLocation.board.MyHexBoard; Hex startHex = hexBoard.getHex(startLocation.i, startLocation.j); if (startHex != null) { Hex endHex = hexBoard.getHex(endLocation.i, endLocation.j); if (endHex != null) { // Get the hexes that are along the way to the path the user clicked on. List <Hex> hexPath = startLocation.board.findPath(startHex, endHex); movePlayer(player, hexPath, callback); numHexesMoved = hexPath.Count; } } return(numHexesMoved); }
private void handleMove(LHGConsole console, String[] arguments) { // move player 1 2,3 if (arguments.Length < 4) { console.WriteLine("Error: Invalid number of arguments for move command!"); } else { if (arguments[1].Equals("player")) { Player player = getPlayer(arguments[2]); if (player == null) { console.WriteLine("Error: Unable to find player '" + arguments[2] + "'!"); } CombatLocation endLocation = getLocation(player, arguments[3]); //this.combatSystem.movePlayer( player, endLocation ); } } }
public int movePlayer(Player player, int i, int j, AnimationCallback callback) { CombatLocation endLocation = new CombatLocation(player.Location.board, i, j, player.Location.direction); return(movePlayer(player, endLocation, callback)); }
public Hex getHexNextTo(CombatLocation location) { return(getHexNextTo(location.getHex(), location.direction)); }