Пример #1
0
        static TileMovement()
        {
            // straight
            North = CtorStraight(0, -1, 0);
            East = CtorStraight(1, 0, 90);
            South = CtorStraight(0, 1, 180);
            West = CtorStraight(-1, 0, 270);

            // inner curves - angles are the quadrant for the +/- 1 we want for direction.
            TurnNE = CtorInnerCurve(UNITS_PER_TILE / 4, 180, 270, 1);
            TurnES = CtorInnerCurve(UNITS_PER_TILE / 4, 270, 360, 1);
            TurnSW = CtorInnerCurve(UNITS_PER_TILE / 4, 0, 90, 1);
            TurnWN = CtorInnerCurve(UNITS_PER_TILE / 4, 90, 180, 1);

            // outer curves - angles are the quadrant for the +/- 1 we want for direction.
            TurnNW = CtorOuterCurve(UNITS_PER_TILE / 2, 360, 270, -1);
            TurnWS = CtorOuterCurve(UNITS_PER_TILE / 2, 270, 180, -1);
            TurnSE = CtorOuterCurve(UNITS_PER_TILE / 2, 180, 90, -1);
            TurnEN = CtorOuterCurve(UNITS_PER_TILE / 2, 90, 0, -1);

            // U turns
            Unorth = CtorUturn(0, -1, 360, 180);
            Ueast = CtorUturn(1, 0, 90, -90);
            Usouth = CtorUturn(0, 1, 180, 0);
            Uwest = CtorUturn(-1, 0, 270, 90);
        }
Пример #2
0
        /// <summary>
        /// Set the location to be entering a new tile
        /// </summary>
        /// <param name="ptMap">The point on the map where entering the tile (not the tile point).</param>
        /// <param name="movement">The movement for travelling through the tile.</param>
        public void SetMapPosition(Point ptMap, TileMovement movement)
        {
            #if DEBUG
            int xOff = ptMap.X%TileMovement.UNITS_PER_TILE;
            Trap.trap((xOff != 0) && (xOff != 6) && (xOff != 18));
            int yOff = ptMap.Y%TileMovement.UNITS_PER_TILE;
            Trap.trap((yOff != 0) && (yOff != 6) && (yOff != 18));
            #endif

            mapPosition = ptMap;
            TileMoves = movement;
            OffsetTileMoves = 0;
        }
Пример #3
0
 /// <summary>
 /// Create the object
 /// </summary>
 /// <param name="mapPosition">The board square located on.</param>
 /// <param name="movement">The movement for the tile placed on</param>
 public BoardLocation(Point mapPosition, TileMovement movement)
 {
     this.mapPosition = new Point(mapPosition.X, mapPosition.Y);
     TileMoves = movement;
     OffsetTileMoves = movement.Moves.Length / 2;
 }