Exemple #1
0
    void Start()
    {
        // Create a new array
        tiles = new GameObject[mapWidth*mapHeight];
        tileWidth = tilePrefab.GetComponent<SpriteRenderer>().bounds.size.x;
        tileHeight = tilePrefab.GetComponent<SpriteRenderer>().bounds.size.y;

        // Load data files
        dataFiles = JSONLoader.fromJSON("Data/terrain_texture_parameters");

        // Generate the texture that will be used for the terrain height, climate, humidity and forest cover
        terrainTexture = new TextureCreator().generateTexture(this.transform, dataFiles.textureParameters[0]);
        forestTexture = new TextureCreator().generateTexture(this.transform, dataFiles.textureParameters[1]);

        generateGrid();
    }