// Player right clicks public void PlayerRightClicksAtWorldPosition(Vector3 worldPosition) { // Return if no selected piece if (!selectedPiece) { return; } // Get clicked on hex GameHex targetHex = gameMap.GetWorldPositionHex(worldPosition); if (targetHex == null) { return; } // Move or attack piece if (actionMap.MoveableToTileAtTileCoords(targetHex.tileCoords)) { gameMap.MovePiece((Unit)selectedPiece, targetHex.hexCoords); actionMap.ClearActionTiles(); return; } if (actionMap.AttackableTileAtTileCoords(targetHex.tileCoords)) { gameMap.AttackPiece(selectedPiece, targetHex.piece); actionMap.ClearActionTiles(); return; } }
public void HexIsMoveable() { unit1.DecreaseSpeed(4); actionMap.CreateActionMap(unit1, gameMap); Vector3Int targetTileCoords = Hex.HexToTileCoords(new Vector3Int(1, -1, 0)); Assert.IsTrue(actionMap.MoveableToTileAtTileCoords(targetTileCoords)); }