void Start()
    {
        EventBus.instance.onBuildingInitiated += StartBuildingProcess;
        prototypingUI.SetActive(false);
        state = BuildingState.READY_FOR_BUILDING;

        inputManager = InputManagerFatory.GetDefaultManager();
    }
    // Start is called before the first frame update
    void Start()
    {
        inputManager                 = InputManagerFatory.GetDefaultManager();
        referenceTerrain             = FindObjectOfType <Terrain>();
        data                         = new TerrainData();
        data.heightmapResolution     = GlobalConstants.CHUNK_RESOLUTION;
        data.size                    = new Vector3(GlobalConstants.CHUNK_SIZE, GlobalConstants.CHUNK_HEIGHT, GlobalConstants.CHUNK_SIZE);
        referenceTerrain.terrainData = data;

        //OnTerrainLoaded(100, 100, GetHeights());
        //GenerateRandomTerrain();
        //EventBus.instance.TerrainGenerationFinished(heights);
        EventBus.instance.onTerrainLoadingComplete += OnWorldChunkLoaded;
    }
    private void FinishTerrainGeneration()
    {
        var serverChunks = GetServerChunks(centralCell.x, centralCell.y);

        FillBigChunkHeights(serverChunks);
        // chunk 0;0 will be at the origin
        var x = (centralCell.x - 1) * GlobalConstants.CHUNK_SIZE / 3.0f;
        var y = (centralCell.y - 1) * GlobalConstants.CHUNK_SIZE / 3.0f;

        ConfigureTerrainComponent(x, y, bigChunkData);

        var cameraPos = InputManagerFatory.GetDefaultManager().InitCameraPosition();
        var chunkPos  = Utility.ToChunkPos(cameraPos);

        cameraCell = chunkPos;

        terrainLoaded = true;

        EventBus.instance.TerrainGenerationFinished(serverChunks);

        EventBus.instance.CloseLoadingDialog();
    }
Exemplo n.º 4
0
 void Start()
 {
     inputManager = InputManagerFatory.GetDefaultManager();
 }