Esempio n. 1
0
        /// <summary>
        /// Gets an off-mesh connection.
        /// </summary>
        /// <param name="polyRef">The reference of the off-mesh connection.</param>
        /// <returns>The off-mesh connection.</returns>
        public NavmeshConnection GetConnectionByRef(uint polyRef)
        {
            IntPtr conn = NavmeshEx.dtnmGetOffMeshConnectionByRef(root, polyRef);

            NavmeshConnection result;

            if (conn == IntPtr.Zero)
            {
                result = new NavmeshConnection();
            }
            else
            {
                result = (NavmeshConnection)Marshal.PtrToStructure(conn
                                                                   , typeof(NavmeshConnection));
            }

            return(result);
        }
        /// <summary>
        /// Gets a copy of the off-mesh connection buffer.
        /// </summary>
        /// <param name="buffer">
        /// The buffer to load the results into.
        /// [Length: >= <see cref="NavmeshTileHeader.connCount"/>]
        /// </param>
        /// <returns>The number of connections returned.</returns>
        public int GetConnections(NavmeshConnection[] buffer)
        {
            if (mOwner.IsDisposed || buffer == null)
                return 0;

            return NavmeshTileEx.dtnmGetTileConnections(mTile
                , buffer
                , buffer.Length);
        }
        /// <summary>
        /// Gets an off-mesh connection.
        /// </summary>
        /// <param name="polyRef">The reference of the off-mesh connection.</param>
        /// <returns>The off-mesh connection.</returns>
        public NavmeshConnection GetConnectionByRef(uint polyRef)
        {
            IntPtr conn = NavmeshEx.dtnmGetOffMeshConnectionByRef(root, polyRef);

            NavmeshConnection result;
            if (conn == IntPtr.Zero)
                result = new NavmeshConnection();
            else
                result = (NavmeshConnection)Marshal.PtrToStructure(conn
                    , typeof(NavmeshConnection));

            return result;
        }