/// <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]));
        }
예제 #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));
 }
예제 #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;
 }
예제 #6
0
 /// <inheritdoc/>
 public virtual int  StepCost(HexCoords coords, Hexside hexsideExit)
 {
     return(IsOnboard(coords) ? this[coords].StepCost(hexsideExit) : -1);
 }
예제 #7
0
 /// <inheritdoc/>
 public THex Neighbour(HexCoords coords, Hexside hexside)
 {
     return(_boardHexes.Neighbour(coords, hexside));
 }
예제 #8
0
        /// <inheritdoc/>
        public int  ElevationHexsideASL(HexCoords coords, Hexside hexside)
        {
            var hex = this[coords];

            return(ElevationBase + hex.ElevationLevel * ElevationStep + hex.HeightHexside(hexside));
        }
예제 #9
0
 /// <inheritdoc/>
 public virtual int  DirectedStepCost(IHex hex, Hexside hexsideExit)
 {
     return(hex == null ? -1 : hex.DirectedStepCost(hexsideExit));
 }
예제 #10
0
 /// <inheritdoc/>
 public abstract int       StepCost(Hexside hexsideExit);
 /// <summary>TODO</summary>
 public NeighbourCoords(HexCoords coords, Hexside hexside) : this()
 {
     Coords = coords; Hexside = hexside;
 }
예제 #12
0
 /// <summary>Default implementation, assuming no blocking hexside terrain.</summary>
 public virtual int       HeightHexside(Hexside hexside) => HeightTerrain;
예제 #13
0
 /// <inheritdoc/>
 public IHex Neighbour(Hexside hexside)
 {
     return(Board[Coords.GetNeighbour(hexside)]);
 }
예제 #14
0
 /// <inheritdoc/>
 public virtual int  DirectedStepCost(Hexside hexsideExit)
 {
     return(Board[Coords.GetNeighbour(hexsideExit)].StepCost(hexsideExit));
 }
예제 #15
0
 /// <inheritdoc/>
 public abstract int  StepCost(Hexside direction);
예제 #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;
예제 #18
0
 /// <inheritdoc/>
 public abstract int       EntryCost(Hexside hexsideExit);
예제 #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]));
 }
예제 #21
0
 /// <inheritdoc/>
 public abstract int       ExitCost(Hexside hexsideExit);
예제 #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]);
 }
예제 #23
0
 /// <inheritdoc/>
 public abstract short?TryStepCost(Hexside hexsideExit);