/// <summary>Returns an <c>HexCoords</c> for the hex in direction <c>hexside</c> from this one.</summary>
        public HexCoords GetNeighbour(Hexside hexside)
        {
            var i = User.X & 1;

            return(new HexCoords(Canon + _hexsideVectorsCanon  [hexside]
                                 , User + _hexsideVectorsUser[i][hexside]));
        }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public virtual int  GetDirectedCostToExit(IHex hex, Hexside hexsideExit)
 {
     //return hex==null ? -1
     //                 : this[hex.Coords].StepCost(hexsideExit);
     return(hex == null ? -1
                : hex.StepCost(hexsideExit));
 }
Ejemplo n.º 3
0
 /// <summary>Returns an <c>HexCoords</c> for the hex in direction <c>hexside</c> from this one.</summary>
 public HexCoords GetNeighbour(Hexside hexside)
 {
     if ((User.X % 2) == 0)
     {
         return(new HexCoords(Canon + HexsideVectorsCanon[(int)hexside]
                              , User + HexsideVectorsUserEven[(int)hexside]));
     }
     else
     {
         return(new HexCoords(Canon + HexsideVectorsCanon[(int)hexside]
                              , User + HexsideVectorsUserOdd[(int)hexside]));
     }
 }
 /// <summary>TODO</summary>
 public static short?DirectedCost <THex>(BoardStorage <Maybe <THex> > boardHexes, HexCoords hexCoords, Hexside hexside)
     where THex : IHex
 {
     return(boardHexes[hexCoords].Bind(hex => hex.TryStepCost(hexside).ToMaybe()).ToNullable());
 }
 /// <summary>TODO</summary>
 public NeighbourHex(IHex hex, Hexside hexsideExit) : this()
 {
     Hex         = hex;
     HexsideExit = hexsideExit;
 }
Ejemplo n.º 6
0
 /// <inheritdoc/>
 public virtual int  StepCost(HexCoords coords, Hexside hexsideExit)
 {
     return(IsOnboard(coords) ? this[coords].StepCost(hexsideExit) : -1);
 }
Ejemplo n.º 7
0
 /// <inheritdoc/>
 public THex Neighbour(HexCoords coords, Hexside hexside)
 {
     return(_boardHexes.Neighbour(coords, hexside));
 }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public int  ElevationHexsideASL(HexCoords coords, Hexside hexside)
        {
            var hex = this[coords];

            return(ElevationBase + hex.ElevationLevel * ElevationStep + hex.HeightHexside(hexside));
        }
Ejemplo n.º 9
0
 /// <inheritdoc/>
 public virtual int  DirectedStepCost(IHex hex, Hexside hexsideExit)
 {
     return(hex == null ? -1 : hex.DirectedStepCost(hexsideExit));
 }
Ejemplo n.º 10
0
 /// <inheritdoc/>
 public abstract int       StepCost(Hexside hexsideExit);
 /// <summary>TODO</summary>
 public NeighbourCoords(HexCoords coords, Hexside hexside) : this()
 {
     Coords = coords; Hexside = hexside;
 }
Ejemplo n.º 12
0
 /// <summary>Default implementation, assuming no blocking hexside terrain.</summary>
 public virtual int       HeightHexside(Hexside hexside) => HeightTerrain;
Ejemplo n.º 13
0
 /// <inheritdoc/>
 public IHex Neighbour(Hexside hexside)
 {
     return(Board[Coords.GetNeighbour(hexside)]);
 }
Ejemplo n.º 14
0
 /// <inheritdoc/>
 public virtual int  DirectedStepCost(Hexside hexsideExit)
 {
     return(Board[Coords.GetNeighbour(hexsideExit)].StepCost(hexsideExit));
 }
Ejemplo n.º 15
0
 /// <inheritdoc/>
 public abstract int  StepCost(Hexside direction);
Ejemplo n.º 16
0
 /// <summary>Default implementation, assuming no blocking hexside terrain.</summary>
 public virtual int       HeightHexside(Hexside hexside)
 {
     return(HeightTerrain);
 }
 /// <summary>Returns true exactly if <c>this</c> has the the eponymous bit from <c>hexside</c> set.</summary>
 /// <param name="this">The Hexsides value to test.</param>
 /// <param name="hexside">Specification of the eponymous bit in <c>this</c> to test.</param>
 public static bool IsSet(this Hexsides @this, Hexside hexside)
 => (@this.GetValue() & ((int)hexside.AsHexsides)) != 0;
Ejemplo n.º 18
0
 /// <inheritdoc/>
 public abstract int       EntryCost(Hexside hexsideExit);
Ejemplo n.º 19
0
 /// <summary>Returns the reversed, or opposite, <c>Hexside</c> to the supplied value.</summary>
 /// <param name="this"></param>
 public static Hexside Reversed(this Hexside @this)
 {
     return((@this <= Hexside.Southeast) ? (@this + 3) : (@this - 3));
 }
 /// <summary>Returns an <c>HexCoords</c> for the hex in direction <c>hexside</c> from this one.</summary>
 public HexCoords GetNeighbour(Hexside hexside)
 {
     return(NewCanonCoords(Canon + HexsideVectors[(int)hexside]));
 }
Ejemplo n.º 21
0
 /// <inheritdoc/>
 public abstract int       ExitCost(Hexside hexsideExit);
Ejemplo n.º 22
0
 /// <summary>The <c>HexsideFlag</c> corresponding to this <c>HexSide</c>.</summary>
 public static HexsideFlags Direction(this Hexside @this)
 {
     return(HexsideFlags[(int)@this]);
 }
Ejemplo n.º 23
0
 /// <inheritdoc/>
 public abstract short?TryStepCost(Hexside hexsideExit);