Пример #1
0
    void Start()
    {
        Application.runInBackground = true;


        m_cSpellData = gameObject.AddComponent(typeof(CSpellData)) as CSpellData;
        gameObject.AddComponent(typeof(CFogSystem));
        m_cTerrian = gameObject.AddComponent(typeof(GlobalTerrain)) as GlobalTerrain;

        m_fFont = Resources.Load("Fonts/NewRocker-Large") as Font;
    }
Пример #2
0
    public LocalTerrain(int terrainWidth, int terrainHeight, int stepSize, GlobalTerrain globalTerrain, LayerManager layerManager)
    {
        gt = globalTerrain;
        gt.lt = this;
        lm = layerManager;

        localTerrainC = new LocalCoordinates(new Vector3(0, 0, 0), terrainWidth, terrainHeight);

        //visibleTerrain = new float[terrainHeight, terrainWidth];
        this.terrainHeight = terrainHeight;
        this.terrainWidth = terrainWidth;

        this.stepSize = stepSize;
    }
Пример #3
0
    public void AssignFunctions(GlobalTerrain globalTerrain, LocalTerrain localTerrain,
        FilterGenerator filterGenerator, FunctionMathCalculator functionMathCalculator,
        RiverGenerator riverGenerator, GridManager gridManager, GUIManager guiManager,
        ErosionGenerator erosionGenerator)
    {
        this.globalTerrain = globalTerrain;
        this.localTerrain = localTerrain;
        this.filterGenerator = filterGenerator;
        this.riverGenerator = riverGenerator;
        this.erosionGenerator = erosionGenerator;

        fmc = functionMathCalculator;

        gm = gridManager;

        rt.AssignFunctions(fmc);
        ds.AssignFunctions(localTerrain);

        this.guiManager = guiManager;
        message = guiManager.message;
    }
Пример #4
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);
    }