Esempio n. 1
0
    void Update()
    {
        if (otherOption)
        {
            Update_();
            return;
        }

        if (buttonObject != null)
        {
            totalTime += Time.deltaTime;
            float tmp = totalTime / buttonObject.attachedTower.researchTime;
            if (tmp >= 1)
            {
                tmp = 1;
                buttonObject.isResearched = true;
                buttonObject.researching  = false;
                totalTime = 0;
                TowerDictionary.SetResearch(buttonObject.attachedTower.towerType, true);
                buttonObject       = null;
                researching        = false;
                fillBar.fillAmount = 0;
            }
            else
            {
                fillBar.fillAmount = tmp;
            }
        }
    }
Esempio n. 2
0
    public void startResearch(SetActiveResearch researchObj)
    {
        if (researching)
        {
            return;
        }

        TowerButtonResearchTab buttonObj = researchObj.activeResearch;

        if (buttonObj == null)
        {
            return;
        }

        buttonObject = buttonObj;
        TowerData tower = buttonObj.attachedTower;

        if (tower.researchCost <= moneyHandler.Money && !buttonObj.researching && !buttonObj.isResearched)
        {
            if (buttonObj.preReq != null)
            {
                if (buttonObj.preReq.isResearched)
                {
                    Debug.Log("Researching");
                    moneyHandler.Money   -= tower.buildCost;
                    buttonObj.researching = true;
                    researching           = true;
                }
            }
            else
            {
                Debug.Log("Researching base tech");
                moneyHandler.Money   -= tower.buildCost;
                buttonObj.researching = true;
                researching           = true;
            }
        }
    }
 public void setActiveResearch(TowerButtonResearchTab obj)
 {
     activeResearch = obj;
 }