Exemplo 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);
        }
    }
    public (bool, float) PriceToUnlockNextOilSlick()
    {
        ResourceManager rm  = GameObject.FindObjectOfType <ResourceManager>();
        OilSlickManager osm = GameObject.FindObjectOfType <OilSlickManager>();

        float levelCost = 100000f * Mathf.Pow(5, (float)osm.CurrentOilSlickLevel);

        return(rm.CurrentMoney >= levelCost, levelCost);
    }
Exemplo n.º 3
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);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        PublishOilUpdate();
        PublishMoneyUpdate();
        PublishEquipmentUpdate();
        PublishEnvironmentHealthUpdate();
        PublishPublicSentimentUpdate();
        PublishOilStorageUpdate();

        PurchaseStartingOilSlick();

        _oilSlickManager = FindObjectOfType <OilSlickManager>();
        _endGameEvent    = FindObjectOfType <EndGameEvent>();
    }