Ejemplo n.º 1
0
    public void PutData()
    {
        time.Pause();
        money     = score.money;
        product   = score.product;
        happiness = score.happiness;
        taxes     = score.moneyTax;
        resMulti  = score.globalResourceMulti;
        timeMulti = score.globalTimeMulti;
        taxMulti  = score.globalTaxMulti;
        Stat();
        Display();
        overPanell.SetActive(true);
        if (Mathf.RoundToInt(timeLine.currrentTime / 10) >= 372)
        {
            gameOverText.text = "Твой бизнес дожил до наших дней, но ты сможешь ещё круче. Попробуй ;)";
        }
        else
        {
            gameOverText.text = "Тебе чуть-чуть не хватило для победы :( Сыграй ещё раз — успех совсем рядом!";
        }
        timeAlive.text = "Вы продержались " + Mathf.RoundToInt(timeLine.currrentTime / 10).ToString() + " месяцев";

        SessionData data = new SessionData(token, money, product, happiness, taxes, resMulti, timeMulti, taxMulti, admin, bux, dining, hr, it, konsult, lawyer, library, market, sale, sport, top, totalMoney, totalProduct, totalTax);

        var json = JsonUtility.ToJson(data);

        Debug.Log(json);
        GameStatSend(json);
    }
Ejemplo n.º 2
0
 public void Pause()
 {
     timeController.Pause();
 }
Ejemplo n.º 3
0
 public void RecieveEvent()
 {
     time.Pause();
     eventPanel.SetActive(true);
 }
Ejemplo n.º 4
0
    void Update()
    {
        gameTime    += Time.deltaTime;
        currrentTime = Mathf.Round(gameTime);

        #region BreakPoint
        if (breakpointCount < breakpointTime.Count)
        {
            if (breakpointTime[breakpointCount] == currrentTime)
            {
                eventSound.Raise();
                breakpointCount += 1;
                eventIndex       = Random.Range(0, allpoints.listOfPoints[breakpointCount - 1].breakpoint.Count);
                Debug.Log("event!!! + " + breakpointCount);
                timeControl.Pause();
                eventPanel.SetActive(true);
                subjectEvent.text = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].Subject;

                int e = Random.Range(0, 100);
                if (e <= eventChance)
                {
                    causeEvent.text = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].Pros;
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyPros == 0)
                    {
                        moneytext = "";
                    }
                    else
                    {
                        moneytext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyPros.ToString() + " контуриков";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessPros == 0)
                    {
                        happytext = "";
                    }
                    else
                    {
                        happytext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessPros.ToString() + " счастья";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductPros == 0)
                    {
                        producttext = "";
                    }
                    else
                    {
                        producttext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductPros.ToString() + " продукта";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiPros == 1)
                    {
                        timemultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiPros < 1)
                        {
                            timemultitext = Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiPros * 100)).ToString() + "%" + " производительности";
                        }
                        else
                        {
                            timemultitext = "-" + System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiPros * 100) - 100), 2).ToString() + "%" + " производительности";
                        }
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiPros == 1)
                    {
                        taxmultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiPros < 1)
                        {
                            taxmultitext = Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiPros * 100)).ToString() + "%" + " снижение издержек";
                        }
                        else
                        {
                            taxmultitext = System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiPros * 100) - 100), 2).ToString() + "%" + " рост издержек";
                        }
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiPros == 1)
                    {
                        moneymultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiPros > 1)
                        {
                            moneymultitext = System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiPros * 100) - 100), 2).ToString() + "%" + " к доходу";
                        }
                        else
                        {
                            moneymultitext = "-" + Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiPros * 100)).ToString() + "%" + " к доходу";
                        }
                    }

                    impactEvent.text = "Эффект: " + moneytext + " " + happytext + " " + producttext + " " + timemultitext + " " + taxmultitext + " " + moneymultitext;

                    score.MoneyOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyPros);
                    score.HappinessOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessPros);
                    score.ProductOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductPros);
                    score.TimeMultiOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiPros);
                    score.TaxMultiOperatiom(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiPros);
                    score.ResourceMultiOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiPros);
                }
                else
                {
                    causeEvent.text = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].Cons;
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyCons == 0)
                    {
                        moneytext = "";
                    }
                    else
                    {
                        moneytext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyCons.ToString() + " контуриков";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessCons == 0)
                    {
                        happytext = "";
                    }
                    else
                    {
                        happytext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessCons.ToString() + " счастья";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductCons == 0)
                    {
                        producttext = "";
                    }
                    else
                    {
                        producttext = allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductCons.ToString() + " продукта";
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiCons == 1)
                    {
                        timemultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiCons > 1)
                        {
                            timemultitext = "-" + System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiCons * 100) - 100), 2).ToString() + "%" + " производительности";
                        }
                        else
                        {
                            timemultitext = Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiCons * 100)).ToString() + "%" + " производительности";
                        }
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiCons == 1)
                    {
                        taxmultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiCons < 1)
                        {
                            taxmultitext = Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiCons * 100)).ToString() + "%" + " снижение издержек";
                        }
                        else
                        {
                            taxmultitext = System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiCons * 100) - 100), 2).ToString() + "%" + " рост издержек";
                        }
                    }
                    if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons == 1)
                    {
                        moneymultitext = "";
                    }
                    else
                    {
                        if (allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons > 1)
                        {
                            Debug.Log(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons + "/// " + System.Math.Round((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons - 1), 2));

                            moneymultitext = System.Math.Round(((allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons - 1) * 100), 2).ToString() + "%" + " к доходу";
                        }
                        else
                        {
                            moneymultitext = "-" + Mathf.Round((100 - allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons * 100)).ToString() + "%" + " к доходу";
                        }
                    }

                    impactEvent.text = "Эффект: " + moneytext + " " + happytext + " " + producttext + " " + timemultitext + " " + taxmultitext + " " + moneymultitext;

                    score.MoneyOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyCons);
                    score.HappinessOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].HappinessCons);
                    score.ProductOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].ProductCons);
                    score.TimeMultiOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TimeMultiCons);
                    score.TaxMultiOperatiom(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].TaxMultiCons);
                    score.ResourceMultiOperation(allpoints.listOfPoints[breakpointCount - 1].breakpoint[eventIndex].MoneyMultiCons);
                }
            }
        }
        #endregion

        #region Clock
        // Clock ticking

        if (currrentTime - 12 * secInMonht * (yearCount + 1) > 0)
        {
            yearCount++;
        }

        currentMonth = Mathf.Floor((currrentTime - 12 * secInMonht * yearCount) / secInMonht);
        currentYear  = 1988 + yearCount;

        // show current date
        if (currentMonth == 12)
        {
            dateText.text = months[0] + " " + currentYear.ToString();
        }
        else
        {
            dateText.text = months[Mathf.RoundToInt(currentMonth)] + " " + currentYear.ToString();
        }

        // collect taxes event
        if (lastMonth != currentMonth)
        {
            taxes.Raise();
            lastMonth = currentMonth;
        }



        // End Game
        if (currrentTime >= endGameTime)
        {
            if (isOver == false)
            {
                Debug.Log("end game");
                isOver = true;
                endGame.Raise();
            }
        }
        #endregion
    }