/// <summary> /// Sets the specified resources and resets the corridor. /// </summary> /// <remarks> /// <para> /// This method is useful when pooling path corridors for use by mulitple clients. /// </para> /// <para> /// See <see cref="Reset"/> for information on the effect of the reset. /// </para> /// <para> /// Existing references will be replaced by the new references. /// </para> /// <para> /// This method cannot be used to set references to null. Attempting to do so will result /// in a failure. /// </para> /// </remarks> /// <param name="corridor">The corridor to update.</param> /// <param name="position">The position to reset to corridor to.</param> /// <param name="query">The query object to use.</param> /// <param name="filter">The filter object to use.</param> /// <returns>True if successful.</returns> public static bool LoadLocals(PathCorridor corridor, NavmeshPoint position , NavmeshQuery query, NavmeshQueryFilter filter) { // Basic checks first. if (position.polyRef == 0 || corridor == null || query == null || filter == null) { return(false); } // Validate optional parameters. // Assign and reset. corridor.mQuery = query; corridor.mFilter = filter; corridor.Reset(position); return(true); }
/// <summary> /// Sets the specified resources and resets the corridor. /// </summary> /// <remarks> /// <para> /// This method is useful when pooling path corridors for use by mulitple clients. /// </para> /// <para> /// See <see cref="Reset"/> for information on the effect of the reset. /// </para> /// <para> /// Existing references will be replaced by the new references. /// </para> /// <para> /// This method cannot be used to set references to null. Attempting to do so will result /// in a failure. /// </para> /// </remarks> /// <param name="corridor">The corridor to update.</param> /// <param name="position">The position to reset to corridor to.</param> /// <param name="query">The query object to use.</param> /// <param name="filter">The filter object to use.</param> /// <returns>True if successful.</returns> public static bool LoadLocals(PathCorridor corridor, NavmeshPoint position , NavmeshQuery query, NavmeshQueryFilter filter) { // Basic checks first. if (position.polyRef == 0|| corridor == null|| query == null|| filter == null) return false; // Validate optional parameters. // Assign and reset. corridor.mQuery = query; corridor.mFilter = filter; corridor.Reset(position); return true; }
/// <summary> /// Released the references to the query and filter. /// </summary> /// <remarks> /// <para> /// <b>Warning:</b> The corridor will not be in a useable state after this operation. /// Using the corridor without successfully calling <see cref="LoadLocals"/> will result in /// undefined behavior. /// </para> /// <para> /// This method is useful when pooling path corridors for use by mulitple clients. /// </para> /// </remarks> /// <param name="corridor">The corridor to update.</param> public static void ReleaseLocals(PathCorridor corridor) { corridor.mQuery = null; corridor.mFilter = null; }