Ejemplo n.º 1
0
    void Start()
    {
        guiManager = GameObject.Find("GUI").GetComponent<GUIManager>();

        terrainWidth = 100;
        terrainHeight = terrainWidth;

        try
        {
            GUIterrainPlannerMenu tpMenu = GameObject.Find("TerrainPlanner").GetComponent<GUIterrainPlannerMenu>();
            patchSize = tpMenu.patch.patchSize;
        }
        catch (Exception e)
        {
            Debug.Log("TerrainPlanner not found");
            patchSize = 64;
        }

        cameraMovement camera = transform.GetComponent<cameraMovement>();
        camera.ChangePosition(new Vector3(0, 100, 0));
        camera.ChangeRotation(new Vector3(90, 0, 0));

        scaleTerrainY = 12;

        int quadrantSize = Math.Max(terrainWidth, terrainHeight);

        layerManager = new LayerManager();

        globalTerrain = new GlobalTerrain(quadrantSize);
        localTerrain = new LocalTerrain(terrainWidth, terrainHeight, 30, globalTerrain, layerManager);
        filterGenerator = new FilterGenerator(quadrantSize, localTerrain);

        functionMathCalculator = new FunctionMathCalculator();
        functionDebugger = new FunctionDebugger();
        functionRiverDigger = new FunctionRiverDigger();
        functionRiverPlanner = new FunctionRiverPlanner();
        functionTerrainManager = new FunctionTerrainManager();

        terrainGenerator = new TerrainGenerator(patchSize);
        riverGenerator = new RiverGenerator(localTerrain);
        erosionGenerator = new ErosionGenerator(localTerrain);

        gridManager = new GridManager(new Vector3(0,0,0), patchSize, patchSize);

        AssignFunctions();
        terrainGenerator.initialize(scaleTerrainY);

        localTerrain.UpdateVisibleTerrain(new Vector3(0, 0, 0), false);
    }