Пример #1
0
        protected internal void RequestPath(Vector2 target, bool hasToReachTarget = false, bool loose = false)
        {
            target.X = Math.Min(Math.Max(target.X, 0), Game1.MapWidth - 0.1f);
            target.Y = Math.Min(Math.Max(target.Y, 0), Game1.MapHeight - 0.1f);
            mPath    = Pathfinder.GetPath(CollisionBoxCenter, target, hasToReachTarget);

            if (loose)
            {
                return;
            }
            if (Vector2.Distance(CollisionBoxCenter, target) > 0.5f && mPath.Empty())
            {
                mPath = Pathfinder.GetPath(CollisionBoxCenter, target, hasToReachTarget, false);
            }
        }