Beispiel #1
0
        ///<summary>
        ///Searches for a safespot
        ///</summary>
        public bool AttemptFindSafeSpot(out Vector3 safespot, Vector3 LOS, PointCheckingFlags flags)
        {
            safespot = vlastSafeSpot;

            Vector3 BotPosition = Bot.Character.Data.Position;

            //Recreate the entire area?
            if (Bot.NavigationCache.CurrentGPArea == null || Bot.NavigationCache.CurrentGPArea.AllGPRectsFailed && !Bot.NavigationCache.CurrentGPArea.centerGPRect.Contains(BotPosition) || !Bot.NavigationCache.CurrentGPArea.GridPointContained(BotPosition))
            {
                Bot.NavigationCache.CurrentGPArea = new GPArea(BotPosition);
            }



            //Check Bot Navigationally blocked
            RefreshNavigationBlocked();
            if (BotIsNavigationallyBlocked)
            {
                return(false);
            }

            //Recreate Bot Current rect?
            if (Bot.NavigationCache.CurrentLocationGPrect == null || Bot.NavigationCache.CurrentLocationGPrect.centerpoint != Bot.Character.Data.PointPosition)
            {
                Bot.NavigationCache.CurrentLocationGPrect = new GPRectangle(BotPosition);
                //Refresh boundary (blocked directions)
                currentLocationBoundary = new AreaBoundary(BotPosition);
                UpdateLocationsBlocked();
            }

            // Bot.NavigationCache.CurrentLocationGPRect.UpdateObjectCount();

            safespot = Bot.NavigationCache.CurrentGPArea.AttemptFindSafeSpot(BotPosition, LOS, flags);
            return(safespot != Vector3.Zero);
        }
Beispiel #2
0
        ///<summary>
        ///Searches for a safespot
        ///</summary>
        public bool AttemptFindSafeSpot(out Vector3 safespot, Vector3 LOS, PointCheckingFlags flags)
        {
            safespot = vlastSafeSpot;

            Vector3 BotPosition = Bot.Character.Data.Position;

            //Recreate the entire area?
            if (Bot.NavigationCache.CurrentGPArea == null || Bot.NavigationCache.CurrentGPArea.AllGPRectsFailed && !Bot.NavigationCache.CurrentGPArea.centerGPRect.Contains(BotPosition) || !Bot.NavigationCache.CurrentGPArea.GridPointContained(BotPosition))
                Bot.NavigationCache.CurrentGPArea = new GPArea(BotPosition);

            //Check Bot Navigationally blocked
            RefreshNavigationBlocked();
            if (BotIsNavigationallyBlocked)
            {
                return false;
            }

            //Recreate Bot Current rect?
            if (Bot.NavigationCache.CurrentLocationGPrect == null || Bot.NavigationCache.CurrentLocationGPrect.centerpoint != Bot.Character.Data.PointPosition)
            {
                Bot.NavigationCache.CurrentLocationGPrect = new GPRectangle(BotPosition);
                //Refresh boundary (blocked directions)
                currentLocationBoundary = new AreaBoundary(BotPosition);
                UpdateLocationsBlocked();
            }

            // Bot.NavigationCache.CurrentLocationGPRect.UpdateObjectCount();

            safespot = Bot.NavigationCache.CurrentGPArea.AttemptFindSafeSpot(BotPosition, LOS, flags);
            return (safespot != Vector3.Zero);
        }