Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        environmentSlider.progress = government.environment;
        sentimentSlider.progress   = government.sentiment;


        if (government.hasGrantedExpandedOilRights)
        {
            expandButton.interactable = false;
            expandButtonText.SetText("Expand Oil Rights (Already Purchased)");
        }
        else
        {
            OilSlickManager osm = GameObject.FindObjectOfType <OilSlickManager>();
            (bool, float)affordability = osm.PriceToUnlockNextOilSlick();

            expandButton.interactable = affordability.Item1 && (government.sentiment >= 0.7);
            string buttonText = "Expand Oil Rights ($" + affordability.Item2.ToString("N2") + ")";
            if (government.sentiment <= 0.7)
            {
                buttonText += " (Requires sentiment >= 70%)";
            }
            expandButtonText.SetText(buttonText);
        }
    }
Ejemplo n.º 2
0
    public void ExpandOilRights()
    {
        ResourceManager rm  = GameObject.FindObjectOfType <ResourceManager>();
        OilSlickManager osm = GameObject.FindObjectOfType <OilSlickManager>();

        (bool, float)affordability = osm.PriceToUnlockNextOilSlick();

        if (rm.AttemptPurchase(affordability.Item2))
        {
            hasGrantedExpandedOilRights = true;
            osm.UnlockOilSlickLevel(osm.CurrentOilSlickLevel + 1);
        }
    }