コード例 #1
0
    public void EnterPoliticalCoordsOK()
    {
        PoliticalCoordsMenuBackground.SetActive(false);
        ChangeMode(POLITICAL_MODE);
        UpdateBalance(); UpdateActions(); UpdateStep();
        stategen protagonist_stategen = ProtagonistState.GetComponent <stategen>();

        protagonist_stategen.Balance = initial_MP; UpdateBalance();
        protagonist_stategen.GetCivilianTax(); protagonist_stategen.GetProductionTax(); protagonist_stategen.GetArmyOutcome();
    }//Executor
コード例 #2
0
    // блок функций для взаимодейтвия с главными параметрами


    public void Step()
    {
        step++;
        UpdateStep();
        action_points = 10; UpdateActions();
        // так бля пора обрабатывать детерминаторы
        foreach (GameObject state in list_of_states)
        {
            stategen st = state.GetComponent <stategen>();
            for (int i = 0; i < st.list_of_provinces.Count; i++)
            {
                if (st.list_of_provinces[i].GetComponent <provincegen>().state != state)
                {
                    Debug.LogError(st);
                }
            }
            if (state != ProtagonistState)
            {
                state.GetComponent <Determinator>().Determinate();
            }
        }
        // так бля пока запускать консеквентор
        Consequentor.Simulate();

        // так бля пора собирать налоги

        foreach (GameObject state in list_of_states)
        {
            stategen st = state.GetComponent <stategen>();
            int      people_growth = 0, prod_growth = 0, edu_growth = 0;
            if (state == ProtagonistState)
            {
                people_growth = (int)((st.GetCivilianTax() + st.GetProductionTax()) * st.ForeignTrade);

                prod_growth = (int)((st.GetCivilianTax() + st.GetProductionTax()) * st.Investments);

                edu_growth = (int)((st.GetCivilianTax() + st.GetProductionTax()) * st.Researches);
            }
            else
            {
                people_growth = (int)((float)(st.political_coords.x + 10) / 200f * st.GetPopulation());
                prod_growth   = (int)((float)(st.political_coords.x - 10) / -200f * st.GetProduction());
                edu_growth    = (int)((float)(st.political_coords.y - 10) / -200f * st.GetEducation());
            }
            for (int i = 0; i < edu_growth; i++)
            {
                st.list_of_provinces[UnityEngine.Random.Range(0, st.list_of_provinces.Count)].GetComponent <provincegen>().education++;
            }
            for (int i = 0; i < prod_growth; i++)
            {
                st.list_of_provinces[UnityEngine.Random.Range(0, st.list_of_provinces.Count)].GetComponent <provincegen>().productions++;
            }
            for (int i = 0; i < people_growth; i++)
            {
                st.list_of_provinces[UnityEngine.Random.Range(0, st.list_of_provinces.Count)].GetComponent <provincegen>().population++;
            }
        }
        stategen protst = ProtagonistState.GetComponent <stategen>();

        SpendMoney(-1 * protst.proficite);
        UpdateMode(); protst.RestructBudget();

        Debug.Log(CheckDiplomacyWin());
        if (CheckSquareWin() || CheckEconomicWin() || CheckDiplomacyWin() || CheckSeparatismWin())
        {
            EndGameMenu.SetActive(true);
        }
        if (ProtagonistState.GetComponent <stategen>().list_of_provinces.Count == 0 || step > 100)
        {
            EndGameMenu.SetActive(false);
            EndGameText.text = "You lose";
        }
    }