/// <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])); }
/// <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)); }
/// <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; }
/// <inheritdoc/> public virtual int StepCost(HexCoords coords, Hexside hexsideExit) { return(IsOnboard(coords) ? this[coords].StepCost(hexsideExit) : -1); }
/// <inheritdoc/> public THex Neighbour(HexCoords coords, Hexside hexside) { return(_boardHexes.Neighbour(coords, hexside)); }
/// <inheritdoc/> public int ElevationHexsideASL(HexCoords coords, Hexside hexside) { var hex = this[coords]; return(ElevationBase + hex.ElevationLevel * ElevationStep + hex.HeightHexside(hexside)); }
/// <inheritdoc/> public virtual int DirectedStepCost(IHex hex, Hexside hexsideExit) { return(hex == null ? -1 : hex.DirectedStepCost(hexsideExit)); }
/// <inheritdoc/> public abstract int StepCost(Hexside hexsideExit);
/// <summary>TODO</summary> public NeighbourCoords(HexCoords coords, Hexside hexside) : this() { Coords = coords; Hexside = hexside; }
/// <summary>Default implementation, assuming no blocking hexside terrain.</summary> public virtual int HeightHexside(Hexside hexside) => HeightTerrain;
/// <inheritdoc/> public IHex Neighbour(Hexside hexside) { return(Board[Coords.GetNeighbour(hexside)]); }
/// <inheritdoc/> public virtual int DirectedStepCost(Hexside hexsideExit) { return(Board[Coords.GetNeighbour(hexsideExit)].StepCost(hexsideExit)); }
/// <inheritdoc/> public abstract int StepCost(Hexside direction);
/// <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;
/// <inheritdoc/> public abstract int EntryCost(Hexside hexsideExit);
/// <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])); }
/// <inheritdoc/> public abstract int ExitCost(Hexside hexsideExit);
/// <summary>The <c>HexsideFlag</c> corresponding to this <c>HexSide</c>.</summary> public static HexsideFlags Direction(this Hexside @this) { return(HexsideFlags[(int)@this]); }
/// <inheritdoc/> public abstract short?TryStepCost(Hexside hexsideExit);