Пример #1
0
        protected void MaybeGeneratePathData()
        {
            PathObjectTypeContainer pathObjectTypes = WorldRoot.Instance.PathObjectTypes;

            if (pathObjectTypes.Count == 0)
            {
                PathData = null;
            }
            else if (WorldRoot.Instance.PathObjectTypes.AllObjectsDirty || locationDirty)
            {
                List <CollisionShape> meshShapes = WorldEditor.Instance.FindMeshCollisionShapes(meshName, displayObject.Entity);
                if (meshShapes.Count == 0)
                {
                    PathData = null;
                }
                else
                {
                    PathData = new PathData();
                    float terrainHeight = WorldEditor.Instance.GetTerrainHeight(location.x, location.z) - location.y;
                    for (int i = 0; i < pathObjectTypes.Count; i++)
                    {
                        PathObjectType type = pathObjectTypes.GetType(i);
                        try {
                            PathData.AddModelPathObject(WorldEditor.Instance.LogPathGeneration, type, name, location,
                                                        displayObject.SceneNode.FullTransform, meshShapes, terrainHeight);
                        }
                        catch (Exception e) {
                            MessageBox.Show(string.Format("An exception was raised when generating pathing information for " +
                                                          "model {0}, for path object type {1}.  The exception message was '{2}'.  Please run the World " +
                                                          "Editor again, with the command-line option --log_paths, save the world file to generate " +
                                                          "pathing information, and zip up the generated file " +
                                                          "PathGenerationLog.txt, found in the World Editor's bin directory, and send it to Multiverse, " +
                                                          "along with the {3} file so the problem can be identified and fixed.",
                                                          name, type.name, e.Message, meshName),
                                            "Error Generating Path Information For Model " + name + "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }