Beispiel #1
0
        /// <summary>
        /// Returns a path to the pool. (If there is room.)
        /// </summary>
        /// <remarks>
        /// <para>
        /// Invalid paths are rejected.(E.g. Wrong buffer sizes.)
        /// </para>
        /// </remarks>
        /// <param name="corridor">The path to add to the pool.</param>
        public void ReturnPath(NavPath path)
        {
            if (mPaths.Count >= mMaxPaths || path == null ||
                path.path.Length != mMaxPathSize ||
                path.straightPath.Length != mMaxStraightPathSize)
            {
                return;
            }

            path.pathCount     = 0;
            path.straightCount = 0;

            mPaths.Push(path);
        }
Beispiel #2
0
        /// <summary>
        /// Sets up the path assets.
        /// </summary>
        /// <remarks>
        /// <para>Notes:</para>
        /// <ul>
        /// <li>This operation sets/unsets the path in-use flag as appropriate.</li>
        /// <li>Re-uses existing assest as appropriate.</li>
        /// <li>Utilizes the agent group pool.</li>
        /// </ul>
        /// </remarks>
        /// <param name="enabled">
        /// True if the path assets should be made ready to use.  False to release all path assets.
        /// </param>
        public void SetPathAssets(bool enabled)
        {
            if (enabled)
            {
                if (path == null)
                {
                    path = agentGroup.GetPath();
                }

                data.flags |= NavFlag.PathInUse;
            }
            else
            {
                agentGroup.ReturnPath(path);
                path        = null;
                data.flags &= ~NavFlag.PathInUse;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Sets up the path assets.
        /// </summary>
        /// <remarks>
        /// <para>Notes:</para>
        /// <ul>
        /// <li>This operation sets/unsets the path in-use flag as appropriate.</li>
        /// <li>Re-uses existing assest as appropriate.</li>
        /// <li>Utilizes the agent group pool.</li>
        /// </ul>
        /// </remarks>
        /// <param name="enabled">
        /// True if the path assets should be made ready to use.  False to release all path assets.
        /// </param>
        public void SetPathAssets(bool enabled)
        {
            if (enabled)
            {
                if (path == null)
                    path = agentGroup.GetPath();

                data.flags |= NavFlag.PathInUse;
            }
            else
            {
                agentGroup.ReturnPath(path);
                path = null;
                data.flags &= ~NavFlag.PathInUse;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Returns a path to the pool. (If there is room.)
        /// </summary>
        /// <remarks>
        /// <para>
        /// Invalid paths are rejected.(E.g. Wrong buffer sizes.)
        /// </para>
        /// </remarks>
        /// <param name="corridor">The path to add to the pool.</param>
        public void ReturnPath(NavPath path)
        {
            if (mPaths.Count >= mMaxPaths || path == null
                || path.path.Length != mMaxPathSize
                || path.straightPath.Length != mMaxStraightPathSize)
            {
                return;
            }

            path.pathCount = 0;
            path.straightCount = 0;

            mPaths.Push(path);
        }