示例#1
0
        void Start()
        {
            // Load the graph..
            string filePath = Application.streamingAssetsPath + "/Examples/NewWorld.json";

            Graph.Graph graph = Launcher.Instance.LoadGraph(filePath);

            if (graph == null)
            {
                Log.Error("Can not find graph file " + filePath);
                return;
            }

            // Get the chunk generator node..
            graph.ForceUpdateNodes();
            _chunkGenerator = (ChunkGeneratorNode)graph.GetFirstNodeWithType(typeof(ChunkGeneratorNode));

            if (_chunkGenerator == null)
            {
                Log.Error("Can not find a chunk generator node in the graph.");
            }

            // Get the main camera.
            _camera = GameObject.Find("Main Camera");
            if (_camera == null)
            {
                Log.Error("Can not camera with the name 'Main Camera'.");
                return;
            }

            _camera.AddComponent <KeyboardControls>();
        }