Ejemplo n.º 1
0
 /// <summary>
 /// Calculate all possible positions to build a ship or a road
 /// </summary>
 /// <param name="game"></param>
 /// <param name="board"></param>
 /// <param name="ships"></param>
 public RoutePlaces(
     XmlGame game,
     BoardVisual board,
     bool ships)
 {
     if (ships)
     {
         foreach (HexSide side in game.PlayerOnTurn.GetShipBuildPlaces(game, board.Board))
             Children.Add(new HexSideVisual(board.CalculatePosition(side), side));
     }
     else
     {
         foreach (HexSide side in game.PlayerOnTurn.GetRoadBuildPlaces(game, board.Board))
             Children.Add(new HexSideVisual(board.CalculatePosition(side), side));
     }
 }
Ejemplo n.º 2
0
 public RoutePlaces(List<HexSide> list, BoardVisual board)
 {
     foreach (HexSide side in list)
     {
         Children.Add(new HexSideVisual(board.CalculatePosition(side), side));
     }
 }
Ejemplo n.º 3
0
        public override BehaviourResult Clicked(RayMeshGeometry3DHitTestResult rayMeshResult, BoardVisual board)
        {
            Road side = rayMeshResult.VisualHit as Road;
            if (side != null)
            {
                List<BuildPointVisual> x = new List<BuildPointVisual>();
                foreach (BuildPointVisual bpv in board.Children.OfType<BuildPointVisual>())
                    x.Add(bpv);
                foreach (BuildPointVisual bp in x)
                    board.Children.Remove(bp);

                BuildPointVisual bpv1 = new BuildPointVisual(board.CalculatePosition(side.Location.HexPoint1), side.Location.HexPoint1);
                BuildPointVisual bpv2 = new BuildPointVisual(board.CalculatePosition(side.Location.HexPoint2), side.Location.HexPoint2);
                board.Children.Add(bpv1);
                board.Children.Add(bpv2);
            }
            return BehaviourResult.NoSuccess;
        }
Ejemplo n.º 4
0
 public RoutePlaces(BoardVisual board, HexSide side)
 {
     foreach (HexSide s in side.GetNeighbours())
     {
         Point2D newPoint = board.CalculatePosition(s);
         HexSideVisual newHexSide = new HexSideVisual(newPoint, s);
         Children.Add(newHexSide);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Calculate three possible locations for the road to be placed at placement gamephase
 /// </summary>
 /// <param name="game"></param>
 /// <param name="board"></param>
 /// <param name="townOrCity"></param>
 public RoutePlaces(XmlGame game, BoardVisual board, HexPoint townOrCity)
 {
     // Add each side to children
     foreach (HexSide side in townOrCity.GetNeighbourSides)
     {
         Point2D newPoint = board.CalculatePosition(side);
         HexSideVisual newHexSide = new HexSideVisual(newPoint, side);
         Children.Add(newHexSide);
     }
 }