Exemplo n.º 1
1
        /// <summary>
        /// Draws gradient rectangle on texture
        /// </summary>t
        public static void DrawGradientRect(this Texture2D texture, int x, int y, int blockWidth, int blockHeight,
            Gradient gradient, Directions progressionDirection)
        {
            Func<int, int, Color> getColor;
            switch (progressionDirection)
            {
                case Directions.Left:
                    getColor = (_x, _y) => gradient.Evaluate(1 - (float) _x/(float) blockWidth);
                    break;
                case Directions.Right:
                    getColor = (_x, _y) => gradient.Evaluate((float) _x/(float) blockWidth);
                    break;
                case Directions.Down:
                    getColor = (_x, _y) => gradient.Evaluate(1 - (float) _y/(float) blockHeight);
                    break;
                case Directions.Up:
                    getColor = (_x, _y) => gradient.Evaluate((float) _y/(float) blockHeight);
                    break;
                default:
                    Debug.LogError("Not supported direction: " + progressionDirection);
                    return;
            }

            var colors = new Color[blockWidth*blockHeight];
            for (int _y = 0; _y < blockHeight; _y++)
            {
                for (int _x = 0; _x < blockWidth; _x++)
                {
                    colors[_x + _y*blockWidth] = getColor(_x, _y);
                }
            }
            texture.SetPixels(x, y, blockWidth, blockHeight, colors);
        }
Exemplo n.º 2
0
 public void Move(Directions direction)
 {
     Position surroundingPosition = _tileFinder.GetSurroundingPosition(_currentTile.Position, direction);
     PositionedTile nextTile = _tileFinder.GetTile(surroundingPosition, Tiles());
     nextTile.Flip();
     _currentTile = nextTile;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Configure the explosion position based on the character's position
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="position"></param>
        /// <returns>The actual explosion position</returns>
        private Point SetExplosionPlace(Directions direction, Point position)
        {
            // TODO fix for isometric view
            switch (direction)
            {
                case Directions.Up:
                    position.X += (int)(chWidth * 0.37);
                    position.Y += verticalOffset + (int)(chHeight * 0.7);
                    break;

                case Directions.Down:
                    position.X += (int)(chWidth * 0.37);
                    position.Y -= verticalOffset;
                    break;

                case Directions.Left:

                    position.Y += chHeight / 2;
                    position.X += (int)(chWidth / 1.7);
                    break;

                case Directions.Right:
                    position.Y += chHeight / 2;
                    position.X += chWidth / 9;
                    break;
            }

            return position;
        }
 internal AxisEdge(VisibilityVertex source, VisibilityVertex target)
     : base(source, target){
     RightBound = double.PositiveInfinity;
     LeftBound = double.NegativeInfinity;
     Direction = CompassVector.DirectionsFromPointToPoint(source.Point, target.Point);
     Debug.Assert(Direction == Directions.East || Direction == Directions.North);
 }
Exemplo n.º 5
0
        public void UpdatePosition(Board board, Directions Direction)
        {
            BaseBlock block = this.GetNeighbour(Direction);

            if (block == null || block.blockCanBeConsumed)
            {
                this.MoveTo(Direction);
            }
            if (block != null && block.blockCanBeConsumed)
            {
                if (block is HeartBlock)
                {
                   
                    board.HeartsTaken++;
                    Sounds.Instance.PlayEffect(SoundType.Heart);
                }
                if (block is ExitBlock)
                {
                    Sounds.Instance.PlayEffect(SoundType.LevelFinish);
                }
                if (!(block is HeartBlock))
                {
                    Sounds.Instance.PlayEffect(SoundType.SnowShuffeld);
                }
                board.RemoveBlock(block);
            }

            if (block != null && block.blockCanBePushed && ((Direction == Directions.East && block.GetNeighbour(Directions.East) == null)
                 ||(Direction == Directions.West && block.GetNeighbour(Directions.West) == null )))
            {
                this.MoveTo(Direction);
                block.MoveTo(Direction);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Returns the square at the specified side of the specified square.  If there is no square at that side (for example, if side isUpRight and the square is at the top of the board) then returns null.
 /// </summary>
 /// <param name="square"></param>
 /// <param name="side"></param>
 /// <returns></returns>
 private static Square AdjacentSquare(Square[,] board, Square square, Directions side)
 {
     switch (side) {
     case Directions.UpRight:
       //If there is a square to the up right and square is not on the right or top sides of the board.  If not then returns null.
       if (square.Left < 7 && square.Top > 0)
         return board[square.Left + 1, square.Top - 1];
       break;
     case Directions.UpLeft:
       //If there is a square to the up left of square and square is not on the left side or the top side.
       if (square.Left > 0 && square.Top > 0)
         return board[square.Left - 1, square.Top - 1];
       break;
     case Directions.DownRight:
       //If there is a square to the down right of square and square is not on the right or bottom sides of the board.
       if (square.Left < 7 && square.Top < 7)
         return board[square.Left + 1, square.Top + 1];
       break;
     case Directions.DownLeft:
       //If there is a square to the down left of square and square is not on the left or bottom sides of the board.
       if (square.Left > 0 && square.Top < 7)
         return board[square.Left - 1, square.Top + 1];
       break;
     //If there is no such square because square is on the wrong side of the board and the appropriate condition was false (otherwise, the function would no longer be running) then return null.
     }
     return null;
 }
Exemplo n.º 7
0
        public void Draw(Graphics g, Directions direction)
        {
            Bitmap animationImage = animationImages[imageIndex];
            // Call the method in a suitable way
            if (animationImages != null)
            {
                switch (direction)
                {
                    case Directions.Up:
                        //animationImage = RotateAnimation(animationImage, RotateFlipType.RotateNoneFlipX, RotateFlipType.RotateNoneFlipX);
                        break;

                    case Directions.Down:
                        //animationImage = RotateAnimation(animationImage, RotateFlipType.RotateNoneFlipX, RotateFlipType.RotateNoneFlipNone);
                        break;

                    case Directions.Left:
                        //animationImage = RotateAnimation(animationImage, RotateFlipType., RotateFlipType.RotateNoneFlipX);
                        break;

                    case Directions.Right:

                        break;
                }

                // Call the base class method to draw the image
                base.DrawFrame(g, animationImage);
            }
        }
 public Position GetSurroundingPosition(Position start, Directions direction)
 {
     Position position;
     switch (direction)
     {
         case Directions.North:
             position = new Position(start.X, start.Y - 1);
             break;
         case Directions.South:
             position = new Position(start.X, start.Y + 1);
             break;
         case Directions.West:
             position = new Position(start.X - 1, start.Y);
             break;
         case Directions.East:
             position = new Position(start.X + 1, start.Y);
             break;
         case Directions.NorthEast:
             position = new Position(start.X + 1, start.Y - 1);
             break;
         case Directions.NorthWest:
             position = new Position(start.X - 1, start.Y - 1);
             break;
         case Directions.SouthWest:
             position = new Position(start.X - 1, start.Y + 1);
             break;
         default:
             position = new Position(start.X + 1, start.Y + 1);
             break;
     }
     return position;
 }
Exemplo n.º 9
0
        public Edge(int x, int y, Directions direction, int depth)
        {
            origin = new Cell {direction = direction, x = x, y = y, depth = depth};
            exit = new Cell {x = x, y = y, depth = depth + 1};

            switch (origin.direction)
            {
                case Directions.Left:
                    exit.direction = Directions.Right;
                    exit.x -= 1;
                    break;
                case Directions.Right:
                    exit.direction = Directions.Left;
                    exit.x += 1;
                    break;
                case Directions.Down:
                    exit.direction = Directions.Up;
                    exit.y -= 1;
                    break;
                case Directions.Up:
                    exit.direction = Directions.Down;
                    exit.y += 1;
                    break;
            }
        }
Exemplo n.º 10
0
        private static void PrintDirections(Directions directions, string origin, string destination)
        {
            Console.WriteLine("Directions: {0} to {1}", origin, destination);
            Console.WriteLine(directions.copyrights);

            for (var r = 0; r < directions.Routes.Count(); r++)
            {
                var route = directions.Routes.ElementAt(r);

                Console.WriteLine();
                Console.WriteLine("Route {0}: {1} [Distiance={2}, Duration={3}]",
                    r + 1, route.summary, route.distance, route.duration);

                for (var l = 0; l < route.Legs.Count(); l++)
                {
                    var leg = route.Legs.ElementAt(l);

                    Console.WriteLine("");
                    Console.WriteLine("Leg #{0}", l + 1);

                    for (var s = 0; s < leg.Steps.Count(); s++)
                    {
                        var step = leg.Steps.ElementAt(s);

                        Console.WriteLine("[{0} - {1} - {2}]: {3}",
                            step.travel_mode, step.duration.text,
                            step.distance.text,
                            step.html_instructions);
                    }
                }
            }
        }
 internal void AddToAdjacentVertex(TransientGraphUtility transUtil
             , VisibilityVertex targetVertex, Directions dirToExtend, Rectangle limitRect) {
     if (!PointComparer.Equal(this.Point, targetVertex.Point)) {
         transUtil.FindOrAddEdge(this.Vertex, targetVertex, InitialWeight);
     }
     ExtendEdgeChain(transUtil, targetVertex, dirToExtend, limitRect);
 }
Exemplo n.º 12
0
 public void SetDirection(Directions dir)
 {
     int index = (int)dir;
     for (int i = 0; i < 4; i++) {
         directions [i].material = (i == index) ? selected : normal;
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Returns if the desired movement is valid
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="floorNumber"></param>
        /// <param name="roomNumber"></param>
        /// <returns></returns>
        public bool CheckValidMove(Directions direction, int floorNumber, int roomNumber)
        {
            bool valid = false;

            int directionValue = (int)direction;

            if (!(direction == Directions.Up | direction == Directions.Down))
            {
                if ((_rooms[floorNumber, roomNumber].Doors[directionValue, 0] == floorNumber))
                {
                    if (!(_rooms[floorNumber, roomNumber].Doors[directionValue, 1] == roomNumber))
                    {
                        valid = true;
                    }
                }
            }
            else
            {
                if (!(_rooms[floorNumber, roomNumber].Doors[directionValue, 0] == floorNumber))
                {
                    valid = true;
                }
            }

            return valid;
        }
Exemplo n.º 14
0
	void Movement ()
	{
		//getaxisraw has binary left right as opposed to the more analogue getaxis
		Vector2 movementVector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

		if (movementVector != Vector2.zero)
		{
			anim.SetBool("isWalking", true);
			anim.SetFloat("inputX", movementVector.x);
			anim.SetFloat("inputY", movementVector.y);


			if (movementVector.x == 1)
				direction = Directions.East;
			else if (movementVector.x == -1)
				direction = Directions.West;
			else if (movementVector.y == 1)
				direction = Directions.North;
			else if (movementVector.y == -1)
				direction = Directions.South;
		}
		else
		{
			anim.SetBool("isWalking", false);
		}

		rBody.MovePosition(rBody.position + movementVector * Time.deltaTime);

	}
Exemplo n.º 15
0
	public void turn(char dir) 
	{
		if (dir == 'L') 
		{
			if (facing != Directions.N) 
			{
				facing -= 1;
			}
			else 
			{
				facing = Directions.W;
			}
		}
		else {
			if (facing != Directions.W) 
			{
				facing += 1;
			}
			else 
			{
				facing = Directions.N;
			}
		}

	}
        internal ObstaclePortEntrance(ObstaclePort oport, Point unpaddedBorderIntersect, Directions outDir, ObstacleTree obstacleTree) {
            ObstaclePort = oport;
            UnpaddedBorderIntersect = unpaddedBorderIntersect;
            OutwardDirection = outDir;

            // Get the padded intersection.
            var lineSeg = new LineSegment(UnpaddedBorderIntersect, StaticGraphUtility.RectangleBorderIntersect(
                                            oport.Obstacle.VisibilityBoundingBox, UnpaddedBorderIntersect, outDir));
            IList<IntersectionInfo> xxs = Curve.GetAllIntersections(lineSeg, oport.Obstacle.VisibilityPolyline, true /*liftIntersections*/);
            Debug.Assert(1 == xxs.Count, "Expected one intersection");
            this.VisibilityBorderIntersect = ApproximateComparer.Round(SpliceUtility.RawIntersection(xxs[0], UnpaddedBorderIntersect));

            this.MaxVisibilitySegment = obstacleTree.CreateMaxVisibilitySegment(this.VisibilityBorderIntersect,
                    this.OutwardDirection, out this.pointAndCrossingsList);

            // Groups are never in a clump (overlapped) but they may still have their port entrance overlapped.
            if (this.Obstacle.IsOverlapped || (this.Obstacle.IsGroup && !this.Obstacle.IsInConvexHull)) {
                this.IsOverlapped = obstacleTree.IntersectionIsInsideAnotherObstacle(/*sideObstacle:*/ null, this.Obstacle
                        , this.VisibilityBorderIntersect, ScanDirection.GetInstance(OutwardDirection));
                if (!this.Obstacle.IsGroup || this.IsOverlapped || this.InteriorEdgeCrossesObstacle(obstacleTree)) {
                    unpaddedToPaddedBorderWeight = ScanSegment.OverlappedWeight;
                }
            }
            if (this.Obstacle.IsInConvexHull && (unpaddedToPaddedBorderWeight == ScanSegment.NormalWeight)) {
                SetUnpaddedToPaddedBorderWeightFromHullSiblingOverlaps(obstacleTree);
            }
        }
Exemplo n.º 17
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.CompareTag("world")){
         direction = Directions.NONE;
         animator.Play("cdman_stand");
     }
     if (col.gameObject.CompareTag ("point")) {
         audioPoint.Play();
         Destroy(col.gameObject);
         Score+=100;
     }
     if (col.gameObject.CompareTag ("point_super")) {
         audioPoint.Play();
         Destroy(col.gameObject);
         Score+=500;
     }
     if (col.gameObject.CompareTag ("enemy")) {
         respounter.On=false;
         Instantiate(dieAnimation, transform.position,Quaternion.Euler(0,0,0));
         Destroy(gameObject);
         //удаляем всех врагов
         foreach(GameObject enemy in GameObject.FindGameObjectsWithTag("enemy"))
         {
             Destroy(enemy);
         }
     }
 }
Exemplo n.º 18
0
        protected int CalcDistanceBetweenTanks(Directions direction)
        {
            int distance = 0;

            if (direction == Directions.Down)
            {
                distance = (this.X - playerTank.X) * (this.X - playerTank.X) +
                           (this.Y + this.Speed - playerTank.Y) * (this.Y + this.Speed - playerTank.Y);
            }
            else if (direction == Directions.Up)
            {
                distance = (this.X - playerTank.X) * (this.X - playerTank.X) +
                           (this.Y - this.Speed - playerTank.Y) * (this.Y - this.Speed - playerTank.Y);
            }
            else if (direction == Directions.Left)
            {
                distance = (this.X - this.Speed - playerTank.X) * (this.X - this.Speed - playerTank.X) +
                           (this.Y - playerTank.Y) * (this.Y - playerTank.Y);
            }
            else if (direction == Directions.Right)
            {
                distance = (this.X + this.Speed - playerTank.X) * (this.X + this.Speed - playerTank.X) +
                           (this.Y - playerTank.Y) * (this.Y - playerTank.Y);
            }

            return distance;
        }
Exemplo n.º 19
0
 public MovementItem(ScreenPoint destination, MovementType type, Directions direction, string animationname)
 {
     this.destination = destination;
     this.type = type;
     this.direction = direction;
     this.animationname = animationname;
 }
Exemplo n.º 20
0
 //This only works assuming the cultist starts facing left before calling this function.
 //Contains hack-y code )=
 public void setFacingDirection(Directions.Direction dir)
 {
     switch(dir)
     {
         case Directions.Direction.UP:
             transform.rotation = normalRotation;
             transform.Rotate(new Vector3(0, 0, 90));
             canvas.transform.Rotate(new Vector3(0, 0, 90)); //To rotate it back to where it should be...
             transform.localScale = new Vector3(-1 * normalScale.x, normalScale.y, normalScale.z);
             canvas.transform.localScale = new Vector3(-1 * canvas.transform.localScale.x, canvas.transform.localScale.y, canvas.transform.localScale.z); //To flip it back to how it should be...
             break;
         case Directions.Direction.DOWN:
             transform.rotation = normalRotation;
             transform.Rotate(new Vector3(0, 0, 90));
             canvas.transform.Rotate(new Vector3(0, 0, -90)); //To rotate it back to where it should be...
             transform.localScale = normalScale;
             break;
         case Directions.Direction.LEFT:
             transform.rotation = normalRotation;
             transform.localScale = normalScale;
             break;
         case Directions.Direction.RIGHT:
             transform.rotation = normalRotation;
             transform.localScale = new Vector3(-1 * normalScale.x, normalScale.y, normalScale.z);
             canvas.transform.localScale = new Vector3(-1 * canvas.transform.localScale.x, canvas.transform.localScale.y, canvas.transform.localScale.z); //To flip it back to how it should be...
             break;
         default:
             break;
     }
 }
Exemplo n.º 21
0
 public Enemy(string texture, Vector2 startLoc, float startSpeed, Directions startDir, int id)
     : base(texture, startLoc, startSpeed, startDir, id)
 {
     Health = 200;
     frameCounts = new int[] { 6 };
     frameVerticalOffset = new int[] { 0 };
 }
Exemplo n.º 22
0
 public OracleSuggestion(UnitPosition position, Directions lockingDirection, Map lockedFinalMap, double metrics = 0)
 {
     Position = position;
     LockingDirection = lockingDirection;
     this.LockedFinalMap = lockedFinalMap;
     Metrics = metrics;
 }
Exemplo n.º 23
0
        public void Update(Directions direction, int position)
        {
            // Sets Direction so the gap created when turning can be filled
            Direction = direction;

            if (direction == Directions.Up)
            {
                Border.Width = 20;
                int y = Border.Y;
                Border.Height += y - position;
                Border.Y = position;
            }

            if (direction == Directions.Down)
            {
                Border.Width = 20;
                Border.Height = position - Border.Y;
            }

            // Records the value of x before updating then sets the new
            // width by adding the distance between x and the new position
            // of x.  Finally sets the new value of x.
            if (direction == Directions.Left)
            {
                int x = Border.X;
                Border.Width += x - position;
                Border.X = position;
            }

            // Expands the width by subtracting the position of the left
            // side of the bar from the new position giving it its width
            if (direction == Directions.Right)
                Border.Width = position - Border.X;
        }
    public void SetDirection(Directions direction)
    {
        float x = 0f;
        float y = 0f;

        switch (direction)
        {
            case Directions.Up:
                y = 1f;
                break;
            case Directions.Down:
                y = -1f;
                break;
            case Directions.Left:
                x = -1f;
                break;
            case Directions.Right:
                x = 1f;
                break;
        }

        if (anim != null)
        {
            anim.SetFloat("InputX", x);
            anim.SetFloat("InputY", y);
        }
    }
Exemplo n.º 25
0
        public override bool CheckCollision(GameObject two, out Directions direction, out Vector2 diffVector)
        {
            direction = Directions.Up; //Default direction value
            diffVector = Vector2.Zero; //Default vector value

            //Get the center point circle
            Vector2 center = new Vector2(this.Position.X + this.Radius, this.Position.Y + this.Radius);

            //Calculate AABB info (center, half-extents)
            Vector2 aabbHalf = new Vector2(two.Size.X / 2, two.Size.Y / 2);
            Vector2 aabbCenter = two.Position + aabbHalf;

            //Get difference vector between both centers
            Vector2 diff = center - aabbCenter;
            Vector2 clamped = new Vector2(clamp(diff.X, -aabbHalf.X, aabbHalf.X), clamp(diff.Y, -aabbHalf.Y, aabbHalf.Y));

            //Add clamped value to AABB Center and get the value of point closest to cirlce
            Vector2 closest = aabbCenter + clamped;

            diff = closest - center;

            if (diff.Length <= this.Radius)
            {
                direction = VectorDirection(diff);
                diffVector = diff;
                return true;
            }

            return false;
        }
Exemplo n.º 26
0
 public void command(CharacterCommands command, params object[] args)
 {
     switch(command)
     {
         case CharacterCommands.SetEntityQuery:
             eq = (IEntityQuery)args[0];
             return;
         case CharacterCommands.Face:
             System.Console.WriteLine("face");
             state = 0;
             d = (Directions)args[0];
             return;
         case CharacterCommands.Walk:
             System.Console.WriteLine("walk");
             state = 1;
             if(d == (Directions)args[0]) step = step==0?1:0;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             break;
         case CharacterCommands.Stop:
             System.Console.WriteLine("stop");
             state = 0;
             return;
         case CharacterCommands.Step:
             System.Console.WriteLine("step");
             state = 2;
             if(d == (Directions)args[0]) step = (step+1)&1;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             return;
     }
 }
Exemplo n.º 27
0
 public void Move(Directions direction)
 {
     switch (direction)
     {
         case Directions.Up:
             if (!DetectSelfCollision(0, -1))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Down:
             if (!DetectSelfCollision(0, 1))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Right:
             if (!DetectSelfCollision(1, 0))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Left:
             if (!DetectSelfCollision(-1, 0))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         default:
             break;
     }
 }
Exemplo n.º 28
0
 //initialize Car
 public Car(int initialValue, int color)
 {
     //PickBrush();
     if (initialValue == 0)
     {
         InitialV = initialValue;
         direction = Directions.Left;
     }
     else if (initialValue == 1)
     {
         InitialV = initialValue;
         direction = Directions.Up;
     }
     else if (initialValue == 2)
     {
         InitialV = initialValue;
         direction = Directions.Right;
     }
     else
     {
         InitialV = initialValue;
         direction = Directions.Down;
     }
     this.color = color;
     AddEnd(); AddEnd();
 }
Exemplo n.º 29
0
 public ScriptEntityMove(Entity entity, Directions direction, int distance)
 {
     this.direction = direction;
     this.distance = distance;
     this.entity = entity;
     this.entity.OnMoveFinished += new Entity.EventHandler(moveFinished);
 }
Exemplo n.º 30
0
        public bool CanTankMove(Tank tank, List<Tank> enemies, Directions direction)
        {
            NewPosition newTankPosition = new NewPosition(tank, direction);
            bool collides = false;

            if (newTankPosition.Row >= 2 && newTankPosition.Row < Data.GetWindowHeight() - 4 &&
                newTankPosition.Column >= 0 && newTankPosition.Column < Data.GetWindowWidth() - 3)
            {
                collides = true;
            }

            for (int elemRow = 0; elemRow < mapElements.GetLength(0); elemRow++)
            {
                for (int elemCol = 0; elemCol < mapElements.GetLength(1); elemCol++)
                {
                    if (mapElements[elemRow, elemCol] != null)
                    {
                        if (DoesItCollideTank(mapElements[elemRow, elemCol], tank, newTankPosition.Row, newTankPosition.Column))
                        {
                            collides = false;
                        }
                    }
                }
            }

            if (collides)
            {
                collides = TankIsOnAtherTank(tank, enemies, newTankPosition);
            }

            return collides;
        }
Exemplo n.º 31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Cell"></param>
 /// <param name="Direction"></param>
 public void AddCell(int Cell, int Direction)
 {
     TransitCells.Add(Cell);
     Directions.Add(Direction);
 }
Exemplo n.º 32
0
 public void Finish()
 {
     _currentDirection = Directions.None;
     _started          = false;
 }
Exemplo n.º 33
0
        //populates the list of the crossroad's available directions
        public void AddDirections()
        {
            //South
            //fixed sn
            List <Point> sn =
                new List <Point>(new Point[]
            {
                new Point(125, 190), new Point(125, 185), new Point(125, 180), new Point(125, 175), new Point(125, 170),
                new Point(125, 165), new Point(125, 160), new Point(125, 130), new Point(125, 125),
                new Point(125, 120), new Point(125, 115), new Point(125, 110), new Point(125, 105),
                new Point(125, 100), new Point(125, 95), new Point(125, 90), new Point(125, 85), new Point(125, 80),
                new Point(125, 75), new Point(125, 70), new Point(125, 65), new Point(125, 60), new Point(125, 55),
                new Point(125, 50), new Point(125, 45), new Point(125, 40), new Point(125, 35), new Point(125, 30),
                new Point(125, 25), new Point(125, 20), new Point(125, 15), new Point(125, 10), new Point(125, 5)
            });
            List <Point> sw =
                new List <Point>(new Point[]
            {
                new Point(110, 190), new Point(110, 185), new Point(110, 180), new Point(110, 175), new Point(110, 170),
                new Point(110, 160), new Point(110, 130), new Point(105, 120), new Point(100, 110),
                new Point(95, 100), new Point(80, 95), new Point(75, 95), new Point(70, 95), new Point(65, 90),
                new Point(55, 90), new Point(40, 85), new Point(35, 85), new Point(30, 85), new Point(25, 85),
                new Point(20, 85), new Point(15, 85), new Point(10, 85)
            });
            List <Point> se =
                new List <Point>(new Point[]
            {
                new Point(125, 190), new Point(125, 185), new Point(125, 180), new Point(125, 175), new Point(125, 170),
                new Point(125, 165), new Point(125, 160), new Point(135, 135), new Point(145, 130),
                new Point(150, 130), new Point(155, 130), new Point(160, 130), new Point(165, 130),
                new Point(170, 130), new Point(175, 130), new Point(180, 130), new Point(185, 130),
                new Point(190, 130)
            });
            //East
            List <Point> en =
                new List <Point>(new Point[]
            {
                new Point(190, 65), new Point(185, 65), new Point(180, 65), new Point(175, 65), new Point(170, 65),
                new Point(165, 65), new Point(130, 55), new Point(125, 40), new Point(125, 35), new Point(125, 30),
                new Point(125, 25), new Point(125, 20), new Point(125, 15), new Point(125, 10)
            });
            List <Point> es =
                new List <Point>(new Point[]
            {
                new Point(190, 80), new Point(185, 80), new Point(180, 80), new Point(175, 80), new Point(170, 80),
                new Point(165, 80), new Point(120, 95), new Point(85, 120), new Point(85, 125), new Point(85, 130),
                new Point(85, 140), new Point(85, 145), new Point(85, 150), new Point(85, 155), new Point(85, 160),
                new Point(85, 165), new Point(85, 170), new Point(85, 175), new Point(85, 180), new Point(85, 185),
                new Point(85, 190)
            });
            List <Point> ew =
                new List <Point>(new Point[]
            {
                new Point(190, 65), new Point(185, 65), new Point(180, 65), new Point(175, 65), new Point(170, 65),
                new Point(165, 65), new Point(130, 65), new Point(125, 65), new Point(120, 65), new Point(115, 65),
                new Point(110, 65), new Point(105, 65), new Point(100, 65), new Point(95, 65), new Point(90, 65),
                new Point(85, 65), new Point(80, 65), new Point(75, 65), new Point(70, 65), new Point(65, 65),
                new Point(60, 65), new Point(55, 65), new Point(50, 65), new Point(45, 65), new Point(40, 65),
                new Point(35, 65), new Point(30, 65), new Point(25, 65), new Point(20, 65), new Point(15, 65),
                new Point(10, 65)
            });
            //West
            List <Point> we =
                new List <Point>(new Point[]
            {
                new Point(5, 125), new Point(10, 125), new Point(15, 125), new Point(20, 125), new Point(25, 125),
                new Point(30, 125), new Point(60, 125), new Point(65, 125), new Point(70, 125), new Point(75, 125),
                new Point(80, 125), new Point(85, 125), new Point(90, 125), new Point(95, 125), new Point(100, 125),
                new Point(105, 125), new Point(110, 125), new Point(115, 125), new Point(120, 125),
                new Point(125, 125), new Point(130, 125), new Point(135, 125), new Point(140, 125),
                new Point(145, 125), new Point(150, 125), new Point(155, 125), new Point(160, 125),
                new Point(165, 125), new Point(170, 125), new Point(175, 125), new Point(180, 125),
                new Point(185, 125), new Point(190, 125)
            });
            List <Point> ws =
                new List <Point>(new Point[]
            {
                new Point(5, 125), new Point(10, 125), new Point(15, 110), new Point(20, 110), new Point(25, 110),
                new Point(30, 125), new Point(60, 130), new Point(65, 140), new Point(65, 145), new Point(65, 150),
                new Point(65, 155), new Point(65, 160), new Point(65, 165), new Point(65, 170), new Point(65, 175),
                new Point(65, 180), new Point(65, 185), new Point(65, 190), new Point(65, 195),
            });
            List <Point> wn =
                new List <Point>(new Point[]
            {
                new Point(5, 110), new Point(10, 110), new Point(15, 110), new Point(20, 110), new Point(25, 110),
                new Point(30, 110), new Point(60, 110), new Point(80, 100), new Point(100, 90), new Point(105, 70),
                new Point(110, 50), new Point(110, 45), new Point(110, 40), new Point(110, 35), new Point(110, 30),
                new Point(110, 25), new Point(110, 20), new Point(110, 15), new Point(110, 10)
            });
            //North
            List <Point> ns =
                new List <Point>(new Point[]
            {
                new Point(65, 10), new Point(65, 15), new Point(65, 20), new Point(65, 25), new Point(65, 30),
                new Point(65, 60), new Point(65, 65), new Point(65, 70), new Point(65, 75), new Point(65, 80),
                new Point(65, 85), new Point(65, 90), new Point(65, 95), new Point(65, 100), new Point(65, 105),
                new Point(65, 110), new Point(65, 115), new Point(65, 120), new Point(65, 125), new Point(65, 130),
                new Point(65, 135), new Point(65, 140), new Point(65, 145), new Point(65, 150), new Point(65, 155),
                new Point(65, 160), new Point(65, 165), new Point(65, 170), new Point(65, 175), new Point(65, 180),
                new Point(65, 185), new Point(65, 190)
            });
            List <Point> ne =
                new List <Point>(new Point[]
            {
                new Point(85, 10), new Point(85, 15), new Point(85, 20), new Point(85, 25), new Point(85, 30),
                new Point(95, 60), new Point(100, 80), new Point(105, 100), new Point(115, 110), new Point(120, 110),
                new Point(125, 110), new Point(130, 110), new Point(135, 110), new Point(140, 110),
                new Point(145, 110), new Point(150, 110), new Point(155, 110), new Point(160, 110),
                new Point(165, 110), new Point(170, 110), new Point(175, 110), new Point(180, 110),
                new Point(185, 110), new Point(190, 110)
            });
            List <Point> nw =
                new List <Point>(new Point[]
            {
                new Point(65, 10), new Point(65, 15), new Point(65, 20), new Point(65, 25), new Point(65, 30),
                new Point(65, 60), new Point(60, 65), new Point(55, 65), new Point(50, 65), new Point(45, 65),
                new Point(40, 65), new Point(35, 65), new Point(30, 65), new Point(25, 65), new Point(20, 65),
                new Point(15, 65), new Point(10, 65)
            });

            //from -> to
            //SN stands for south to north and so on
            //south
            Directions.Add(new Direction(sn, "South-North"));
            Directions.Add(new Direction(se, "South-East"));
            Directions.Add(new Direction(sw, "South-West"));
            ////East
            Directions.Add(new Direction(en, "East-North"));
            Directions.Add(new Direction(es, "East-South"));
            Directions.Add(new Direction(ew, "East-West"));
            ////West
            Directions.Add(new Direction(we, "West-East"));
            Directions.Add(new Direction(ws, "West-South"));
            Directions.Add(new Direction(wn, "West-North"));
            //North
            Directions.Add(new Direction(ns, "North-South"));
            Directions.Add(new Direction(ne, "North-East"));
            Directions.Add(new Direction(nw, "North-West"));
        }
Exemplo n.º 34
0
        public async Task <List <List <BusDirections> > > BusAlgorithm(Coordinates coordinates, string startPlace, string endPlace, int cityId)
        {
            StaticData.ListStopAccessibilities = Context.StopsAccessibility.Where(x => x.InitialStop.CityId == cityId).ToList();
            StaticData.ListStopOrdered         = Context.StopsOrdered.Where(x => x.BusStop.CityId == cityId).Include(x => x.BusStop).ToList();
            List <BusStopViewModel> toLocation = new List <BusStopViewModel>();
            List <BusStopViewModel> busStops   = await BusStops(cityId);

            toLocation = FindStopsInRadius(coordinates.StartingPoint, busStops).ToList();
            int stopsTaken = 3 - toLocation.Count;

            for (int i = 0; i < stopsTaken; i++)
            {
                toLocation.Add(FindNearestBusStopWithRemove(coordinates.StartingPoint, busStops));
            }
            if (stopsTaken > 0)
            {
                busStops.AddRange(toLocation.Skip(3 - stopsTaken));
            }
            List <BusStopViewModel> toDestination = new List <BusStopViewModel>();

            toDestination = FindStopsInRadius(coordinates.EndPoint, busStops).ToList();
            stopsTaken    = 3 - toDestination.Count;
            for (int i = 0; i < stopsTaken; i++)
            {
                toDestination.Add(FindNearestBusStopWithRemove(coordinates.EndPoint, busStops));
            }
            busStops.AddRange(toDestination.Skip(3 - stopsTaken));
            bool tryOnFoot = false;
            var  paths     = new List <List <StopAccessibleViewModel> >();
            List <List <StopAccessibleViewModel> > pathsWithTransfer = new List <List <StopAccessibleViewModel> >();
            List <List <StopAccessibleViewModel> > directPaths       = new List <List <StopAccessibleViewModel> >();

            for (int i = 0; i < toLocation.Count; i++)
            {
                for (int j = 0; j < toDestination.Count; j++)
                {
                    if (toLocation[i].Id == toDestination[j].Id)
                    {
                        tryOnFoot = true;
                        continue;
                    }

                    var result = GetBiDirectionalBFSAsync(toLocation[i].Id, toDestination[j].Id, coordinates.EndPoint);
                    if (result == null)
                    {
                        continue;
                    }
                    if (result.Count == 2)
                    {
                        pathsWithTransfer.Add(result[0]);
                        directPaths.Add(result[1]);
                    }
                    else
                    {
                        if (result[0].Count == 1)
                        {
                            directPaths.Add(result[0]);
                        }
                        else
                        {
                            pathsWithTransfer.Add(result[0]);
                        }
                    }
                }
            }
            if (directPaths.Count != 0)
            {
                paths.Add(BestDirectPath(coordinates.StartingPoint, coordinates.EndPoint, directPaths));
            }
            if (pathsWithTransfer.Count != 0)
            {
                paths.Add(BestDirectPath(coordinates.StartingPoint, coordinates.EndPoint, pathsWithTransfer));
            }
            List <List <BusDirections> > busDirections = new List <List <BusDirections> >();

            for (int i = 0; i < paths.Count; i++)
            {
                busDirections.Add(await GetDirectionsBus(coordinates, paths[i], startPlace, endPlace));
            }
            if (DistanceBetween(coordinates.StartingPoint, coordinates.EndPoint) < 0.5 || tryOnFoot)
            {
                Directions d = await GetDirectionsByFoot(coordinates.StartingPoint, coordinates.EndPoint);

                BusDirections footDirections = new BusDirections();
                footDirections.Polyline      = d.Polylines.First();
                footDirections.Distance      = d.Distance;
                footDirections.Duration      = d.Duration;
                footDirections.LocationEnd   = startPlace;
                footDirections.LocationStart = endPlace;
                footDirections.Method        = "foot";
                busDirections.Insert(0, new List <BusDirections>()
                {
                    footDirections
                });
            }
            return(busDirections.ToList());
        }
Exemplo n.º 35
0
 public void ChangeDirection(Directions direction)
 {
     this.Direction = direction;
 }
Exemplo n.º 36
0
 public Orange(int[] gridSize, int cellSize, Game game, int[] cell, Directions dir, float speed) : base(gridSize, cellSize, game, cell, dir, playerColor, speed)
 {
     scatterModeTargetCell = new int[] { gridSize[0], 0 };
     name = "clyde";
 }
Exemplo n.º 37
0
 public Gesture()
 {
     _currentDirection = Directions.None;
 }
Exemplo n.º 38
0
 public GestureData(Directions direction, float angle, float distance)
 {
     this.direction = direction;
     this.angle     = angle;
 }
Exemplo n.º 39
0
 public patch_TriggerSpikes(EntityData data, Vector2 offset, Directions dir) : base(data, offset, dir)
 {
     // dummy constructor
 }
Exemplo n.º 40
0
 void Rotate(Directions way)
 {
     transform.Rotate(new Vector3(0, rotationAmount * ((way.Equals(Directions.TurnLeft)) ? -1 : 1), 0));
     transform.Rotate(new Vector3(0, rotationAmount * ((way.Equals(Directions.TurnLeft)) ? -1 : 1), 0));
 }
Exemplo n.º 41
0
 public PrimaryKeyAttribute(Directions direction = Directions.Ascending, bool autoIncrement = true) : base()
 {
     Direction     = direction;
     AutoIncrement = autoIncrement;
 }
Exemplo n.º 42
0
 private XVector3 GetPoint(Directions dir) => unity.GetClosestPoint(_Centre, dir);
Exemplo n.º 43
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Contacts(RaycastHit2D _hit, Directions _dir)
 {
     hit = _hit;
     dir = _dir;
 }
Exemplo n.º 44
0
        /// <summary>
        /// Constructs partial box with specified faces
        /// </summary>
        public static MeshDraft PartialBox(Vector3 width, Vector3 length, Vector3 height, Directions parts)
        {
            Vector3 corner0 = -width / 2 - length / 2 - height / 2;
            Vector3 corner1 = width / 2 + length / 2 + height / 2;

            var draft = new MeshDraft {
                name = "Hexahedron"
            };

            if ((parts & Directions.Left) == Directions.Left)
            {
                draft.Add(Quad(corner0, height, length));
            }
            if ((parts & Directions.Right) == Directions.Right)
            {
                draft.Add(Quad(corner1, -length, -height));
            }
            if ((parts & Directions.Down) == Directions.Down)
            {
                draft.Add(Quad(corner0, length, width));
            }
            if ((parts & Directions.Up) == Directions.Up)
            {
                draft.Add(Quad(corner1, -width, -length));
            }
            if ((parts & Directions.Back) == Directions.Back)
            {
                draft.Add(Quad(corner0, width, height));
            }
            if ((parts & Directions.Forward) == Directions.Forward)
            {
                draft.Add(Quad(corner1, -height, -width));
            }
            return(draft);
        }
Exemplo n.º 45
0
        static internal VisibilityEdge FindNextEdge(VisibilityGraph vg, VisibilityVertex vertex, Directions dir)
        {
            VisibilityVertex nextVertex = FindNextVertex(vertex, dir);

            return((null == nextVertex) ? null : vg.FindEdge(vertex.Point, nextVertex.Point));
        }
Exemplo n.º 46
0
 public void ctor(EntityData data, Vector2 offset, Directions dir)
 {
     ctor(data.Position + offset, GetSize(data, dir), dir, data.Float("delayTime", DelayTime));
 }
Exemplo n.º 47
0
 public extern void ctor(Vector2 position, int size, Directions direction);
Exemplo n.º 48
0
 public void ctor(Vector2 position, int size, Directions direction, float delayTime)
 {
     ctor(position, size, direction);
     customDelayTime = delayTime;
 }
Exemplo n.º 49
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reflex"></param>
        /// <param name="param"></param>
        /// <returns>Return true if the TouchGestureFilter passes.  Ignoring the other filters.</returns>
        public override bool MatchAction(Reflex reflex, out object param)
        {
            // Based on gesture type, we check if the gesture has been recognized/performed this frame to see
            // if this filter may have something to do!
            bool result = IsPerformed;

            // ** UNUSED **
            // Return as a parameter a vector that can be used for input to the movement system, so
            // that players can drive and turn bots using mouse buttons.
            // The touch filters don't have a use for this parameter at this time.
            param = null;

            // Did the gesture just begin this frame? Useful for 'once' filters and such.
            wasPerformed = WasPerformed;

            if (result)
            {
                // If we have a Once modifier, clear it on wasPerformed
                if (wasPerformed)
                {
                    for (int i = 0; i < reflex.Modifiers.Count; i++)
                    {
                        OnceModifier om = reflex.Modifiers[i] as OnceModifier;
                        if (om != null)
                        {
                            om.Reset(reflex);
                        }
                    }
                }

                // Set the touch position and touch actor based on TouchEdit data and
                // whether we've hit an actor or not.
                bool meFilter = reflex.Data.FilterExists("filter.me");
                if (TouchEdit.HitInfo.ActorHit != null)
                {
                    reflex.TouchPosition = TouchEdit.HitInfo.ActorPosition;
                    reflex.TouchActor    = TouchEdit.HitInfo.ActorHit;
                }
                else
                {
                    reflex.TouchActor = null;

                    if (!meFilter)
                    {
                        reflex.TouchPosition = TouchEdit.HitInfo.TerrainPosition;
                    }
                    else
                    {
                        reflex.TouchPosition = null;
                    }
                }

                // Gesture-type specific behavior goes here.
                if (type == TouchGestureFilterType.Rotate)
                {
                    deltaRotation = TouchGestureManager.Get().RotateGesture.RotationDelta;
                }
                else if (type == TouchGestureFilterType.Swipe)
                {
                    direction = TouchGestureManager.Get().SwipeGesture.SwipeDirection;
                }
                else if (type == TouchGestureFilterType.Slide)
                {
                    // Slide is unique in that it cares about what actor you began the slide on, not where
                    // you are now. The touch position is your current touch position, however.
                    // Here we override the TouchActor set above.
                    reflex.TouchPosition = TouchEdit.HitInfo.TerrainPosition;
                    reflex.TouchActor    = TouchInput.InitialActorHit;
                }
                else if (type == TouchGestureFilterType.Tap)
                {
                    tapPosition = TouchGestureManager.Get().TapGesture.Position;
                }
                else if (type == TouchGestureFilterType.Touching)
                {
                }
            }

            // Don't hold onto a ref to a dead bot.
            if (reflex.TouchActor != null && reflex.TouchActor.CurrentState == GameThing.State.Inactive)
            {
                reflex.TouchActor    = null;
                reflex.TouchPosition = null;
            }

            return(result);
        }
Exemplo n.º 50
0
 private static extern int GetSize(EntityData data, Directions dir);
Exemplo n.º 51
0
 public void Join(IItemName columnName, Directions sortDirection = Directions.Ascending)
 {
     NextExpression = new SortExpression(columnName, sortDirection);
 }
Exemplo n.º 52
0
    public void Split()
    {
        Debug.Log("splitting " + limbData.splitDirections.Count);

        for (int i = 0; i < limbData.splitDirections.Count; i++)
        {
            Debug.Log("splitting2");
            for (int ii = 0; ii < limbData.splitDirections[i].directions.Length; ii++)
            {
                Debug.Log("splitting3");
                if (limbData.splitDirections[i].directions[ii] > 0)
                {
                    Debug.Log("splitting4");

                    int [] rotatedDirections = limbData.growthDirections.directions; //the childs default direction is the same as the parent

                    int dir = ii;

                    switch (ii)
                    {
                    case 0:
                        //top left from parent direction...
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        break;

                    case 1:    //up from parent direction (so continuing in parent direction - no change)...
                        break;

                    case 2:    //top right from parent direction...
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        break;

                    case 3:
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        break;

                    case 4:
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        break;

                    case 5:
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        rotatedDirections = shiftDirectionsRight(rotatedDirections);
                        break;

                    case 6:
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        break;

                    case 7:
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        rotatedDirections = shiftDirectionsLeft(rotatedDirections);
                        break;

                    case 8:
                        break;
                    }

                    //tell the Tree to grow the a limb of the child generation with the rotatedDirections
                    Directions newDirections = new Directions();
                    newDirections.directions = rotatedDirections;

                    parentTree.CreateLimb(currentX, currentY, limbData.splitGeneration, newDirections);
                }
            }
        }
    }
Exemplo n.º 53
0
        private void OnGUI()
        {
            var e = Event.current;

            if (e.type == EventType.MouseMove || e.type == EventType.MouseDrag)
            {
                if (!m_MouseDown)
                {
                    return;
                }

                var direction = CalculateDirection(e);
                if (direction != m_Direction)
                {
                    direction = Directions.Stop;
                }

                if (direction != m_LastDirection)
                {
                    ChangeTexture(direction);
                }
                else
                {
                    m_LastDirection = direction;
                }
            }
            else if (e.type == EventType.MouseDown)
            {
                m_MouseDown = true;

                m_Direction = CalculateDirection(e);
                ChangeTexture(m_Direction);
            }
            else if (e.type == EventType.MouseUp)
            {
                m_MouseDown = false;
                rawImageComponent.texture = m_DefaultTexture;

                if (m_LastDirection == m_Direction)
                {
                    switch (m_Direction)
                    {
                    case Directions.North:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(0, -1, 0);
                        break;

                    case Directions.East:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(1, 0, 0);
                        break;

                    case Directions.South:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(0, 1, 0);
                        break;

                    case Directions.West:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(-1, 0, 0);
                        break;

                    case Directions.NorthEast:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(1, -1, 0);
                        break;

                    case Directions.SouthEast:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(1, 1, 0);
                        break;

                    case Directions.SouthWest:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(-1, 1, 0);
                        break;

                    case Directions.NorthWest:
                        OpenTibiaUnity.MiniMapRenderer.TranslatePosition(-1, -1, 0);
                        break;

                    default:
                        break;
                    }
                }

                m_LastDirection = Directions.Stop;
                m_Direction     = Directions.Stop;
            }
        }
Exemplo n.º 54
0
 public TargetEnemyController(IEnemyService _enemyService, IPathService _pathService, IGameService _gameService, Vector3 _spawnLocation, EnemyScriptableObject _enemyScriptableObject, int currentNodeID, Directions spawnDirection, bool _hasShield) : base(_enemyService, _pathService, _gameService, _spawnLocation, _enemyScriptableObject, currentNodeID, spawnDirection, _hasShield)
 {
     enemyType = EnemyType.TARGET;
 }
Exemplo n.º 55
0
 // collide with a rebound in a specific direction
 public virtual bool Collide(Vector2 currentObjectOffset, GameObject otherObject, Vector2 otherObjectOffset, Directions dir)
 {
     _rebounded = false;
     foreach (var box in _collisionBoxes)
     {
         foreach (var otherBox in otherObject.CollisionBoxes)
         {
             if (box.Collide(currentObjectOffset, otherBox, otherObjectOffset))
             {
                 this.HandleCollisionWithObject(currentObjectOffset, box, otherObject, otherObjectOffset, otherBox, dir);
                 otherObject.HandleCollisionWithObject(otherObjectOffset, otherBox, this, currentObjectOffset, box, dir);
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 56
0
 public SortExpression(IItemName columnName, Directions sortDirection = Directions.Ascending)
 {
     _columnName    = columnName ?? throw new ArgumentNullException(nameof(columnName));
     _sortDirection = sortDirection;
 }
Exemplo n.º 57
0
 public void Rotate()
 {
     Direction = Direction == Directions.West ? Directions.North : Direction + 1;
 }
Exemplo n.º 58
0
 public virtual void HandleCollisionWithObject(Vector2 currentObjectOffset, CollisionBox collidingBox, GameObject otherObject,
                                               Vector2 otherObjectOffset, CollisionBox otherCollidingBox, Directions dir)
 {
 }
Exemplo n.º 59
0
 public Turtle(int x, int y, Directions direction)
 {
     _x        = x;
     _y        = y;
     Direction = direction;
 }
Exemplo n.º 60
0
        static internal Point FindBendPointBetween(Point sourcePoint, Point targetPoint, Directions finalEdgeDir)
        {
            Directions targetDir = PointComparer.GetDirections(sourcePoint, targetPoint);

            Debug.Assert(!PointComparer.IsPureDirection(targetDir), "pure direction has no bend");
            Directions firstDir = targetDir & ~finalEdgeDir;

            Debug.Assert(PointComparer.IsPureDirection(firstDir), "firstDir is not pure");

            // Move along the first direction. If the first direction is horizontal then
            // targetPoint is at the correct horizontal position, and vice-versa.
            return(IsVertical(firstDir)
                    ? new Point(sourcePoint.X, targetPoint.Y)
                    : new Point(targetPoint.X, sourcePoint.Y));
        }