Example #1
0
    public void ReadFromMap(Vector2 uv)
    {
        Vector2 pixelToInspect = new Vector2((uv.x * this.texture.width), (this.texture.height - (uv.y * this.texture.height)));

        Color32 c = this.texture.GetPixel((int)pixelToInspect.x, (int)pixelToInspect.y);

        Debug.Log("Color clicked: " + c);

        Continent continentClicked;

        try
        {
            continentClicked = MapColorToContinent [c];
        }
        catch (Exception e)
        {
            //Debug.Log ( "ReadFromMap::Couldn't read map at these coordinates. Returning Oceans." );

            Console.WriteLine(e);

            PlayerGameManager.lastContinentClicked = "Oceans";

            return;
        }

        //Debug.Log ( "Continent clicked: " + continentClicked.Name );

        PlayerGameManager.lastContinentClicked = continentClicked.Name;
        PlayerGameManager.OnLastContinentClickedChange();
    }