/// <summary> /// Resets the build to the <see cref="NavmeshBuildState.Inactive"/> state, clearing all /// build data. /// </summary> public void ResetBuild() { mBuildData = new TileBuildData(); mTileSet = null; mInputGeom = null; mInputInfo = new InputBuildInfo(); mNMGenProcessors = null; mConnections = null; mBoundsMin = Vector3.zero; mBoundsMax = Vector3.zero; mIsDirty = true; }
internal bool SetInputData(BuildContext context , InputGeometry geometry , InputBuildInfo info , INMGenProcessor[] processors , ConnectionSet connections , bool threadSafeOnly) { // Remember: Never allow this method to clear the input geometry. // Note: Don't set class fields until it is safe. if (geometry == null) { context.LogError("Set input data: Invalid parameters.", this); return(false); } // Generate the processor set. processors = org.critterai.ArrayUtil.Compress(processors); List <INMGenProcessor> lprocessors = new List <INMGenProcessor>(); if (processors != null) { lprocessors.AddRange(processors); } NMGenBuildFlag bflags = mConfig.BuildFlags; bool threadCheckFail = false; // This section makes sure we don't get duplicate processors. // It also checks for thread-safety. foreach (INMGenProcessor p in lprocessors) { if (p is FilterLedgeSpans) { bflags &= ~NMGenBuildFlag.LedgeSpansNotWalkable; } if (p is FilterLowHeightSpans) { bflags &= ~NMGenBuildFlag.LowHeightSpansNotWalkable; } if (p is LowObstaclesWalkable) { bflags &= ~NMGenBuildFlag.LowObstaclesWalkable; } if (threadSafeOnly && !p.IsThreadSafe) { context.LogError(p.Name + " processor is not thread-safe.", this); threadCheckFail = true; } } if (threadCheckFail) { context.LogError("One or more processors is not thread-safe.", this); return(false); } lprocessors.AddRange(ProcessorSet.GetStandard(bflags)); ProcessorSet pset = ProcessorSet.Create(lprocessors.ToArray()); if (pset == null) { context.LogError("Set input data: No NMGen processors available.", this); return(false); } // If necessary, re-create the tile set definition. Vector3 bmin; Vector3 bmax; DeriveBounds(geometry.BoundsMin, geometry.BoundsMax, out bmin, out bmax); if (mBuildData.IsTiled) { mTileSet = TileSetDefinition.Create(bmin, bmax, mConfig.GetConfig(), geometry); if (mTileSet == null) { context.LogError("Set input data: Create tile build definition: Unexpected error." + " Invalid input data or configuration." , this); return(false); } } // Everything is OK. Set the rest of the fields. mNMGenProcessors = pset; mBoundsMin = bmin; mBoundsMax = bmax; mInputGeom = geometry; mInputInfo = info; mConnections = (connections == null ? ConnectionSet.CreateEmpty() : connections); mIsDirty = true; return(true); }