Ejemplo n.º 1
0
    /*
     *	Funcion: Start()
     *
     *	En Unity, la funcion Start() de cualquier script que herede de MonoBehaviour se ejecuta automaticamente al inicio del programa.
     *
     *	-Guarda el mapa de alturas seleccionado como dato persistente, para que permanezca a traves del cambio de escenas desde "inicio"
     *   hasta "simulacion"
     *  -Carga el mapa de alturas seleccionado.
     *  -Carga e inicializa el renderer y el espacio de simulacion.
     */
    void Start()
    {
        controlador = this;

        if (PersistentData.GlobalData != null && PersistentData.GlobalData.heightmapSelected)
        {
            heightmap = PersistentData.GlobalData.heightmap;
        }

        map_loader = new MapLoader(tamano_y, tamano_x, tamano_z, getHeightmapUrl(heightmap));

        esp_renderer = GameObject.Find("Renderer").GetComponent <EspRenderer> ();
        esp_renderer.inicializarScheduledCells();

        Espacio esp = new Espacio(tamano_x, tamano_y, tamano_z, sensibilidad);

        espacio.rend = esp_renderer;
        esp_renderer.inicializar(espacio);

        //GameObject combinedTerrainObj = Instantiate(Resources.Load("CeldaTerreno", typeof(GameObject))) as GameObject;
        //esp_renderer.CombineTerrain(combinedTerrainObj);
    }
Ejemplo n.º 2
0
    /*
     *	Funcion: Start()
     *
     *	En Unity, la funcion Start() de cualquier script que herede de MonoBehaviour se ejecuta automaticamente al inicio del programa.
     *
     *	-Guarda el mapa de alturas seleccionado como dato persistente, para que permanezca a traves del cambio de escenas desde "inicio"
     * 	 hasta "simulacion"
     * 	-Carga el mapa de alturas seleccionado.
     *  -Carga e inicializa el renderer y el espacio de simulacion.
     */
    void Start()
    {
        controlador = this;

        if (PersistentData.GlobalData != null && PersistentData.GlobalData.heightmapSelected) {
            heightmap = PersistentData.GlobalData.heightmap;
        }

        map_loader = new MapLoader (tamano_y, tamano_x, tamano_z, getHeightmapUrl(heightmap));

        esp_renderer = GameObject.Find ("Renderer").GetComponent<EspRenderer> ();
        esp_renderer.inicializarScheduledCells ();

        Espacio esp = new Espacio(tamano_x, tamano_y, tamano_z, sensibilidad);

        espacio.rend = esp_renderer;
        esp_renderer.inicializar (espacio);

            //GameObject combinedTerrainObj = Instantiate(Resources.Load("CeldaTerreno", typeof(GameObject))) as GameObject;
            //esp_renderer.CombineTerrain(combinedTerrainObj);
    }