/// <summary> /// Adds an agent to the manager. /// </summary> /// <param name="position"> /// The current position of the agent within the navigation mesh. /// </param> /// <param name="agentParams">The agent configuration.</param> /// <returns> /// A reference to the agent object created by the manager, or null on error. /// </returns> public CrowdAgent AddAgent(Vector3 position , CrowdAgentParams agentParams) { if (IsDisposed) { return(null); } IntPtr ptr = IntPtr.Zero; CrowdAgentCoreState initialState = new CrowdAgentCoreState(); int index = CrowdManagerEx.dtcAddAgent(root , ref position , ref agentParams , ref ptr , ref initialState); if (index == -1) { return(null); } mAgents[index] = new CrowdAgent(this, ptr, index); agentStates[index] = initialState; return(mAgents[index]); }
/// <summary> /// Adds an agent to the manager. /// </summary> /// <param name="position"> /// The current position of the agent within the navigation mesh. /// </param> /// <param name="agentParams">The agent configuration.</param> /// <returns> /// A reference to the agent object created by the manager, or null on error. /// </returns> public CrowdAgent AddAgent(Vector3 position , CrowdAgentParams agentParams) { if (IsDisposed) return null; IntPtr ptr = IntPtr.Zero; CrowdAgentCoreState initialState = new CrowdAgentCoreState(); int index = CrowdManagerEx.dtcAddAgent(root , ref position , ref agentParams , ref ptr , ref initialState); if (index == -1) return null; mAgents[index] = new CrowdAgent(this, ptr, index); agentStates[index] = initialState; return mAgents[index]; }