/// <summary> /// Request all unmanaged resources controlled by the object be /// immediately freed and the object marked as disposed. /// </summary> /// <remarks> /// <para> /// If the object was created using a public constructor the resources will be freed /// immediately. /// </para> /// </remarks> public override void RequestDisposal() { // Note: There is no external unmanaged allocation. if (root != IntPtr.Zero && ResourceType == AllocType.Local) { NavmeshQueryFilterEx.dtqfFree(root); } root = IntPtr.Zero; }
/// <summary> /// The traversal cost for each area, indexed by area. /// [Default: <see cref="DefaultAreaCost"/>] /// </summary> /// <param name="index">The area.</param> /// <returns>The traversal cost of the area.</returns> public float this[int index] { get { return(NavmeshQueryFilterEx.dtqfGetAreaCost(root, index)); } set { NavmeshQueryFilterEx.dtqfSetAreaCost(root, index, value); } }
/// <summary> /// Constructor. /// </summary> /// <param name="areaCount">The number of used areas.</param> public NavmeshQueryFilter(int areaCount) : base(AllocType.Local) { root = NavmeshQueryFilterEx.dtqfAlloc(); mAreaCount = Math.Min(Navmesh.MaxArea + 1, mAreaCount); }
/// <summary> /// Constructor for a filter with the maximum number of areas. /// (<see cref="Navmesh.MaxArea"/> + 1) /// </summary> public NavmeshQueryFilter() : base(AllocType.Local) { root = NavmeshQueryFilterEx.dtqfAlloc(); mAreaCount = Navmesh.MaxArea + 1; }