/// <summary> /// Gets the agent associated with the specified neighbor. /// </summary> /// <param name="neighbor">The agent neighbor data.</param> /// <returns>The agent associated with the neighbor data, or null on error.</returns> public CrowdAgent GetNeighbor(CrowdNeighbor neighbor) { if (IsDisposed || neighbor.index >= mManager.MaxAgents) { return(null); } return(mManager.mAgents[neighbor.index]); }
/// <summary> /// Gets data related to the neighbors in the vicinity of the agent. /// </summary> /// <remarks> /// <para> /// Only available after after a <see cref="CrowdManager"/> update. /// </para> /// </remarks> /// <param name="buffer"> /// A buffer to load with the neighbor data. /// [Length: >= <see cref="CrowdNeighbor.MaxNeighbors"/>] /// </param> /// <returns>The number of neighbors in the buffer, or -1 on error.</returns> public int GetNeighbors(CrowdNeighbor[] buffer) { if (IsDisposed || buffer == null || buffer.Length < CrowdNeighbor.MaxNeighbors) { return -1; } int count = CrowdAgentEx.dtcaGetAgentNeighbors(root , buffer , buffer.Length); return count; }
/// <summary> /// Gets the agent associated with the specified neighbor. /// </summary> /// <param name="neighbor">The agent neighbor data.</param> /// <returns>The agent associated with the neighbor data, or null on error.</returns> public CrowdAgent GetNeighbor(CrowdNeighbor neighbor) { if (IsDisposed || neighbor.index >= mManager.MaxAgents) return null; return mManager.mAgents[neighbor.index]; }