public void Move(Directions direction)
        {
            var sprite             = Owner.GetComponent <Sprite>();
            var wantedTilePosition = sprite.TilePosition + UtilityService.ConvertDirectionToVector(direction);

            if (Collision((int)wantedTilePosition.X, (int)wantedTilePosition.Y))
            {
                return;
            }
            wantedPosition = new Vector2(wantedTilePosition.X * Tile.Width, wantedTilePosition.Y * Tile.Height);
            InMovement     = true;
            animationWalking.ChangeDirection(direction);
            Owner.GetComponent <Animation>().PlayAnimation(animationWalking);
        }
        protected override bool ShouldTriggerEvents()
        {
            var sprite                 = Owner.GetComponent <Sprite>();
            var playerSprite           = worldData.GetWorldObject("player").GetComponent <Sprite>();
            var currentDirection       = (Directions)(sprite.DrawFrame.Y / sprite.DrawFrame.Height);
            var currentDirectionVector = UtilityService.ConvertDirectionToVector(currentDirection);

            for (int n = 0; n < Range; n++)
            {
                var position = sprite.TilePosition + currentDirectionVector * (n + 1);
                if (playerSprite.TilePosition == position)
                {
                    return(true);
                }
                var collision = Owner.GetComponent <Collision>();
                if (collision.CheckCollision((int)position.X, (int)position.Y))
                {
                    return(false);
                }
            }
            return(false);
        }
        private void CheckNode(Directions direction, PathNode currentNode, Vector2 goalTilePosition,
                               IList <ICollisionComponent> collisions)
        {
            var directionVector = UtilityService.ConvertDirectionToVector(direction);
            var newPosition     = currentNode.TilePosition + directionVector;

            if (!collisions.Any(c => c.Collide(newPosition)))
            {
                var oldNode = openList.FirstOrDefault(o => o.TilePosition == newPosition);
                if (oldNode != null)
                {
                    if (currentNode.CostFromStartPosition + PathNode.TileCost < oldNode.CostFromStartPosition)
                    {
                        oldNode.Parent = currentNode;
                        oldNode.CostFromStartPosition = currentNode.CostFromStartPosition + PathNode.TileCost;
                    }
                }
                else
                {
                    openList.Add(new PathNode(newPosition, goalTilePosition, currentNode));
                }
            }
        }