public void Start()
    {
        timedButton = transform.Find("TimedButton").gameObject.GetComponent <TimedButton>();

        if (product != null)
        {
            product.UpdateMarketValue();
            product.UpdateUpgradeCost();
            timedButton.profit = product.profitPerUnit;
        }
        else if (entertainment != null)
        {
            entertainment.UpdateMarketValue();
            entertainment.UpdateUpgradeCost();
            timedButton.profit = entertainment.GetIncomePerSecond();
        }
        else if (software != null)
        {
            software.UpdateMarketValue();
            software.UpdateUpgradeCost();
            timedButton.profit = software.GetIncomePerSecond();
        }
        else if (service != null)
        {
            service.UpdateMarketValue();
            service.UpdateUpgradeCost();
            timedButton.profit = service.GetIncomePerSecond();
        }
        else if (item == null)
        {
            Destroy(gameObject);
        }

        transform.Find("Label").gameObject.GetComponent <TextMesh>().text = item.tag;

        timedButton.timeToFinish = item.time;
        timedButton.cost         = item.cost;
        timedButton.retail       = item.price;

        timedButton.viability = item.viability;
        timedButton.customers = item.customers;

        info.transform.Find("CostText").gameObject.GetComponent <TextMesh>().text   = MoneyParsing.ParseMoney(item.adjustedCost);
        info.transform.Find("PriceText").gameObject.GetComponent <TextMesh>().text  = MoneyParsing.ParseMoney(item.adjustedPrice);
        info.transform.Find("ProfitText").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoney(timedButton.profit);

        upgradeButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.upgradeCost);
        factoryButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.GetFactoryUpgradeCost());

        // Debug.Log(item.name + ".png");
        timedButtonIcon.GetComponent <MeshRenderer>().material.mainTexture = Resources.Load("ProductIcons/" + item.name) as Texture;

        ToggleInterface();
    }
    public void Update()
    {
        if (isOpen)
        {
            // float profit = item.price - item.cost;
            // timedButton.profit = profit;
            float income = 0;

            if (product != null)
            {
                product.UpdateMarketValue();
                product.UpdateUpgradeCost();
                timedButton.profit = product.profitPerUnit;
            }
            else if (entertainment != null)
            {
                entertainment.UpdateMarketValue();
                entertainment.UpdateUpgradeCost();
                timedButton.profit = entertainment.GetIncomePerSecondPerItem();
                income             = entertainment.GetIncomePerSecond();
            }
            else if (software != null)
            {
                software.UpdateMarketValue();
                software.UpdateUpgradeCost();
                timedButton.profit = software.GetIncomePerSecondPerItem();
                income             = software.GetIncomePerSecond();
            }
            else if (service != null)
            {
                service.UpdateMarketValue();
                service.UpdateUpgradeCost();
                timedButton.profit = service.GetIncomePerSecondPerItem();
                income             = service.GetIncomePerSecond();
            }
            else if (item == null)
            {
                Destroy(gameObject);
            }



            // if((gameplay.gameTime % 60) == 0){ // Collect income every minute from income streams i.e. not products
            // company.SetMoney(company.GetMoney() + income);
            // }

            timedButton.cost   = item.adjustedCost;
            timedButton.retail = item.adjustedPrice;

            info.transform.Find("CostText").gameObject.GetComponent <TextMesh>().text   = MoneyParsing.ParseMoney(item.adjustedCost);
            info.transform.Find("PriceText").gameObject.GetComponent <TextMesh>().text  = MoneyParsing.ParseMoney(item.adjustedPrice);
            info.transform.Find("ProfitText").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoney(timedButton.profit);

            upgradeButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.upgradeCost);
            factoryButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.GetFactoryUpgradeCost());
        }
    }
 public void Update()
 {
     if (isOpen)
     {
         hireButton.transform.Find("Label").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(worker.cost);
         info.transform.Find("Workforce").gameObject.GetComponent <TextMesh>().text   = (worker.workforce).ToString();
     }
 }
    public void Start()
    {
        transform.Find("Label").gameObject.GetComponent <TextMesh>().text = worker.tag;

        hireButton.transform.Find("Label").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(worker.cost);
        info.transform.Find("Workforce").gameObject.GetComponent <TextMesh>().text   = (worker.workforce).ToString();

        ToggleInterface();
    }
Beispiel #5
0
 public void Update()
 {
     if (isOpen)
     {
         increaseButton.transform.Find("Label").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(marketing.cost);
         info.transform.Find("Quantity").gameObject.GetComponent <TextMesh>().text        = (marketing.quantity).ToString();
     }
 }
Beispiel #6
0
    public void Start()
    {
        transform.Find("Label").gameObject.GetComponent <TextMesh>().text = marketing.tag;

        increaseButton.transform.Find("Label").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(marketing.cost);
        info.transform.Find("Quantity").gameObject.GetComponent <TextMesh>().text        = (marketing.quantity).ToString();

        ToggleInterface();
    }