Exemplo n.º 1
0
        /// <summary>
        /// Creates a new graph from current geometry input
        /// </summary>
        /// <param name="settings">Settings</param>
        /// <returns>Returns the new graph</returns>
        public override IGraph CreateGraph(PathFinderSettings settings)
        {
            // Prepare input data
            this.ChunkyMesh = ChunkyTriMesh.Build(this);

            // Create graph
            var graph = new Graph()
            {
                Input    = this,
                Settings = settings as BuildSettings,
            };

            // Generate navigation meshes and gueries for each agent
            foreach (var agent in graph.Settings.Agents)
            {
                var nm      = NavMesh.Build(this, graph.Settings, agent);
                var mmQuery = new NavMeshQuery();
                mmQuery.Init(nm, graph.Settings.MaxNodes);

                graph.MeshQueryDictionary.Add(agent, mmQuery);
            }

            return(graph);
        }