Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        clockRunning = false;
        Debug.Log("Enter the World Scene!");
        // Assign the world created from the loading screen.
        TheWorld = LoadingScreenController.TheWorld;
        // Generate the model files eventually

        // Construct the model from text files
        if (TheWorld == null)
        {
            TheWorld = new World(50, 50, false);
        }

        // Construct the elevation view
        // Get the Mesh components
        MeshFilter   meshFilter   = GetComponent <MeshFilter>();
        MeshRenderer meshRenderer = GetComponent <MeshRenderer>();
        MeshCollider meshCollider = GetComponent <MeshCollider>();
        // Create and attach the mesh
        Mesh mesh = WorldView.BuildMesh(TheWorld.elevationVertices);

        meshFilter.mesh         = mesh;
        meshCollider.sharedMesh = mesh;
        // Create and attach the texture
        meshRenderer.sharedMaterial.mainTexture = WorldView.BuildElevationTexture(TheWorld);
        currentView = "Elevation";
        Debug.Log("Elevation View Made!");
        // Set the time
        day  = 0;
        year = 1;
        // Initialize the Game interaction Controllers
        mouseController = new TileMouseOver(meshCollider, meshRenderer);
    }
Exemplo n.º 2
0
    // Toggles between the two world display methods
    public void ToggleView()
    {
        MeshRenderer meshRenderer = GetComponent <MeshRenderer>();

        switch (currentView)
        {
        case "Elevation":
            meshRenderer.sharedMaterial.mainTexture = WorldView.BuildHabitatTexture(TheWorld, textureMap);
            mouseController.ToggleButtonDisplayName(currentView);
            currentView = "Habitat";
            Debug.Log("Habitat View Made!");
            break;

        case "Habitat":
            meshRenderer.sharedMaterial.mainTexture = WorldView.BuildElevationTexture(TheWorld);
            mouseController.ToggleButtonDisplayName(currentView);
            currentView = "Elevation";
            Debug.Log("Elevation View Made!");
            break;
        }
    }