Exemplo n.º 1
0
    public void stageCreatorUserData()
    {
        deleteWorkLineObjs();
        addTopWorkLinePanel();
        SaveData userData = DataController.instance.userData;

        money      = userData.money;
        superMoney = userData.superMoney;

        //To only show one buy panel
        bool lineActiveFlag = true;

        for (int i = 0; i < DataController.instance.dataModel.stageDeepLevel.Count; i++)
        {
            GameObject instanceWorkLine = Instantiate(workLine);
            WorkLine   workLineObj      = instanceWorkLine.GetComponent <WorkLine>();
            DataModel  dataModel        = DataController.instance.dataModel;


            instanceWorkLine.transform.SetParent(content.gameObject.transform);
            workLineObj.workLineCostMoney      = dataModel.stageDeepLevel[i].workLineCostMoney;
            workLineObj.workLineCostSuperMoney = dataModel.stageDeepLevel[i].workLineCostSuperMoney;
            workLineObj.id             = dataModel.stageDeepLevel[i].id;
            workLineObj.workPanel.deep = dataModel.stageDeepLevel[i].deept;
            workLineObj.workPanel.setWorkLineNumberTxt();

            workLineObj.workPanel.level          = userData.workPanelData[i].level;
            workLineObj.workPanel.lineActiveFlag = userData.workPanelData[i].lineActiveFlag;
            workLineObj.workPanel.money          = userData.workPanelData[i].money;

            workLineObj.workingFlag = userData.workPanelData[i].lineActiveFlag;

            setTopWorkLineData(userData);

            workLineObj.workPanel.setStats();
            workLineObj.workPanel.setStatsText();
            workLineObj.workPanel.setLoadTxt();

            //Issue with the scale and position, need to fix Gabriel
            instanceWorkLine.gameObject.transform.localScale = new Vector3(1, 1, 1);
            instanceWorkLine.GetComponent <RectTransform>().localPosition = new Vector3(1, 1, 1);

            if (userData.workPanelData[i].lineActiveFlag)
            {
                workLineObj.showWorkPanel();
            }
            else if (lineActiveFlag)
            {
                workLineObj.showBuyPanel();
                lineActiveFlag = false;
            }
            else
            {
                workLineObj.hidePanels();
            }

            listWorkLine.Add(workLineObj);
        }
        calculateOffGameMoney();
    }
Exemplo n.º 2
0
    void addUserData(int i, WorkLine workLineObj)
    {
        SaveData userData = DataController.instance.userData;

        if (DataController.instance.userData.workPanelData [i] != null)
        {
            if (DataController.instance.userData.workPanelData [i].level != 1)
            {
                workLineObj.workPanel.level = userData.workPanelData [i].level;
                workLineObj.workPanel.money = userData.workPanelData [i].money;
            }
        }
    }
Exemplo n.º 3
0
    public override IEnumerator extractMoney()
    {
        while (true)
        {
            WorkLine workline = GameManager.instance.listWorkLine[workLineIndexCollector];
            yield return(new WaitForSeconds(timeDown));

            if (workline.workingFlag && load - (workline.workPanel.money + money) > 0)
            {
                money += workline.workPanel.money;
                workline.workPanel.money = 0;
                workline.workPanel.setLoadTxt();
                workLineIndexCollector++;
                elevator.GetComponent <ElevatorEntity>().moveToPosition(workline.elevatorPosition.transform);
            }
            else
            {
                int saveDiference = load - money;
                if (workline.workingFlag)
                {
                    workline.workPanel.money -= saveDiference;
                    workline.workPanel.setLoadTxt();
                    money += saveDiference;
                    changeMoneyTxt();
                }
                elevator.GetComponent <ElevatorEntity>().moveToPosition(elevatorPosition.transform);
                yield return(new WaitForSeconds(timeUp * workLineIndexCollector));

                moneyStorage          += money;
                money                  = 0;
                workLineIndexCollector = 0;
                changeMoneyStorageTxt();
            }
            changeMoneyTxt();
        }
    }
Exemplo n.º 4
0
    public void stageCreator()
    {
        deleteWorkLineObjs();
        addTopWorkLinePanel();

        for (int i = 0; i < DataController.instance.dataModel.stageDeepLevel.Count; i++)
        {
            GameObject instanceWorkLine = Instantiate(workLine);
            WorkLine   workLineObj      = instanceWorkLine.GetComponent <WorkLine>();
            DataModel  dataModel        = DataController.instance.dataModel;

            instanceWorkLine.transform.SetParent(content.gameObject.transform);
            workLineObj.workLineCostMoney      = dataModel.stageDeepLevel[i].workLineCostMoney;
            workLineObj.workLineCostSuperMoney = dataModel.stageDeepLevel[i].workLineCostSuperMoney;
            workLineObj.id             = dataModel.stageDeepLevel[i].id;
            workLineObj.workPanel.deep = dataModel.stageDeepLevel[i].deept;
            workLineObj.workPanel.setWorkLineNumberTxt();

            //Issue with the scale and position, need to fix Gabriel
            instanceWorkLine.gameObject.transform.localScale = new Vector3(1, 1, 1);
            instanceWorkLine.GetComponent <RectTransform>().localPosition = new Vector3(1, 1, 1);

            workLineObj.workPanel.setStats();
            workLineObj.workPanel.setStatsText();
            workLineObj.workPanel.setLoadTxt();
            if (i == 0)
            {
                workLineObj.showBuyPanel();
            }
            else
            {
                workLineObj.hidePanels();
            }
            listWorkLine.Add(workLineObj);
        }
    }