コード例 #1
0
ファイル: NavAgentGroup.cs プロジェクト: zwong91/Titan
        /// <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);
        }
コード例 #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;
            }
        }
コード例 #3
0
ファイル: NavAgent.cs プロジェクト: oathx/Six
        /// <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;
            }
        }
コード例 #4
0
ファイル: NavAgentGroup.cs プロジェクト: oathx/Six
        /// <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);
        }