예제 #1
0
    IEnumerator Do()
    {
        doing = true;
        sfx.Play();
        float fadeSecs = 1.0f;
        float hangSecs = 1.0f;
        float amount   = (255f / (50f * fadeSecs)) / 255f;

        for (int i = 0; i < 50 * fadeSecs; i++)
        {
            for (int j = 0; j < tornadoes.Length; j++)
            {
                Color c = tornadoes[j].GetComponent <SpriteRenderer>().color;
                c.a += amount;
                Debug.Log(c.a);
                tornadoes[j].GetComponent <SpriteRenderer>().color = c;
                tornadoes[j].GetComponent <SpriteRenderer>().UpdateGIMaterials();
            }
            yield return(new WaitForFixedUpdate());
        }
        for (int i = 0; i < 50 * hangSecs; i++)
        {
            yield return(new WaitForFixedUpdate());
        }
        for (int i = 0; i < 50 * fadeSecs; i++)
        {
            for (int j = 0; j < tornadoes.Length; j++)
            {
                Color c = tornadoes[j].GetComponent <SpriteRenderer>().color;
                c.a -= amount;
                Debug.Log(c.a);
                tornadoes[j].GetComponent <SpriteRenderer>().color = c;
            }
            yield return(new WaitForFixedUpdate());
        }
        GainLossEffect gle = GameObject.Find("Player").GetComponent <GainLossEffect>();

        gle.Handle(1.0f, 0.9f); // force red money text effect
        gle.loss_sfx.Play();    // force loss sound effect
        MainValues.money = 0.5f * MainValues.money;
        sfx.Stop();
        doing = false;
    }
예제 #2
0
    public static void Year()
    {
        float money_before = money;

        // Do citizen taxes
        float tax_amount = tax_rate * citizen_wealth;

        money          += tax_amount;
        citizen_wealth -= tax_amount;
        citizen_wealth  = Mathf.Max(0.0f, citizen_wealth);

        // Educate citizens
        citizen_smarts += education / 5.0f;

        // Give rest of gov money
        government_wealth += government_salaries;
        money             -= government_salaries;
        money              = Mathf.Max(0.0f, money);

        // Take out spent money
        money -= education + military;
        money  = Mathf.Max(0.0f, money);

        // Foreign relations
        float foreign_result = 2f * outside_agitation_value * (((military_base - military) / military_base) / 100.0f);

        if (foreign_result > 0.0f)
        {
            outside_agitation *= Mathf.Min(5.0f, EndData.year / 4.0f);
        }
        outside_agitation += foreign_result;
        outside_agitation  = Mathf.Max(0.0f, outside_agitation);
        outside_agitation  = Mathf.Min(1.0f, outside_agitation);

        float money_after = money;

        GainLossEffect gle = GameObject.Find("Player").GetComponent <GainLossEffect>();

        gle.Handle(money_before, money_after);
    }