Beispiel #1
0
    public void Onclick()
    {
        GameObject system    = GameObject.Find("EventSystem");
        DevilBank  devilBank = system.GetComponent <DevilBank>();

        people[currentPersonNumber].SetActive(false);
        people.RemoveAt(currentPersonNumber);
        //if the game isn't over
        if (devilBank.lose != true)
        {
            currentPersonNumber = Random.Range(0, people.Count);
            people[currentPersonNumber].SetActive(true);
            currentPersonName = people[currentPersonNumber].name;
            yearCounter      += 1;
        }
    }
    // Update is called once per frame
    void Update()
    {
        GameObject   system       = GameObject.Find("EventSystem");
        EventManager Eventmanager = system.GetComponent <EventManager>();
        Offer        offer        = system.GetComponent <Offer>();
        DevilBank    devilBank    = system.GetComponent <DevilBank>();
        Canvas       canvas       = GameObject.Find("Canvas").GetComponent <Canvas>();

        //updates stats
        Money.text = "Money: " + devilBank.wealthSlider.value + "K";
        IQ.text    = "IQ: " + devilBank.IQSlider.value;
        EQ.text    = "EQ: " + devilBank.EQSlider.value;
        Hap.text   = "Happiness: " + devilBank.happinessSlider.value;
        Life.text  = "Life: " + devilBank.ageSlider.value;


        //gameover messages
        if (devilBank.wealthSlider.value <= 0)
        {
            Death();
            infoText.GetComponent <Text>().text = "You Went Bankrupt...";
        }

        else if (devilBank.ageSlider.value <= 0)
        {
            Death();
            infoText.GetComponent <Text>().text = "You Died...";
        }
        else if (devilBank.IQSlider.value <= 0)
        {
            Death();
            infoText.GetComponent <Text>().text = "Your to stupider to live...";
        }
        else if (devilBank.EQSlider.value <= 0)
        {
            Death();
            infoText.GetComponent <Text>().text = "Everyone Hates You...";
        }
        else if (devilBank.happinessSlider.value <= 0)
        {
            Death();
            infoText.GetComponent <Text>().text = "Now You're Depressed...";
        }
        if (Eventmanager.yearCounter > peopleInAYear)
        {
            int events = Random.Range(0, 4);
            print(events);
            if (events == 0)
            {
                infoText2.GetComponent <Text>().text = "Suprise! God isn't happy with what you're doing. Stats go down";
                IEnumerator coroutine = Info();
                StartCoroutine(coroutine);
                devilBank.wealthSlider.value    -= 50;
                devilBank.ageSlider.value       -= 20;
                devilBank.IQSlider.value        -= 50;
                devilBank.EQSlider.value        -= 50;
                devilBank.happinessSlider.value -= 25;
            }
            else if (events == 1)
            {
                infoText2.GetComponent <Text>().text = "Your clients defaulted on their loans";
                IEnumerator coroutine = Info();
                StartCoroutine(coroutine);
                //if the clients have been lent something, take it back
                if (offer.IQChange > 0)
                {
                    devilBank.IQSlider.value -= offer.IQChange;
                }
                if (offer.EQChange > 0)
                {
                    devilBank.EQSlider.value -= offer.EQChange;
                }
                if (offer.ageChange > 0)
                {
                    devilBank.ageSlider.value -= offer.ageChange;
                }
                if (offer.wealthChange > 0)
                {
                    devilBank.wealthSlider.value -= offer.wealthChange;
                }
                if (offer.happinessChange > 0)
                {
                    devilBank.happinessSlider.value -= offer.happinessChange;
                }
            }


            year += 1;
            Eventmanager.yearCounter = 0;
            peopleInAYear            = Random.Range(2, 5);
        }
        yearText.GetComponent <Text>().text = "Year: " + year;
    }
Beispiel #3
0
    public void Onclick()
    {
        GameObject   system       = GameObject.Find("EventSystem");
        EventManager Eventmanager = system.GetComponent <EventManager>();
        TextManager  textmanager  = system.GetComponent <TextManager>();
        DevilBank    devilBank    = system.GetComponent <DevilBank>();
        Canvas       canvas       = GameObject.Find("Canvas").GetComponent <Canvas>();


        totalValue = (EQValue * (int)EQOffer.value + IQValue * (int)IQOffer.value + AgeValue * (int)ageOffer.value * 2 + WealthValue * (int)wealthOffer.value / 10 + HappinessValue * (int)happinessOffer.value);

        if (Eventmanager.currentPersonName == "Robber")
        {
            threshold = 100; //robber charges you more
        }
        else
        {
            threshold = 0;
        }


        if (totalValue >= threshold)
        {
            devilBank.EQSlider.value        -= EQOffer.value;
            devilBank.IQSlider.value        -= IQOffer.value;
            devilBank.ageSlider.value       -= ageOffer.value;
            devilBank.wealthSlider.value    -= wealthOffer.value;
            devilBank.happinessSlider.value -= happinessOffer.value;

            IQChange        += IQOffer.value / 2;
            EQChange        += EQOffer.value / 2;
            ageChange       += ageOffer.value / 2;
            wealthChange    += wealthOffer.value / 2;
            happinessChange += happinessOffer.value / 2;
        }
        else
        {
            if (Eventmanager.currentPersonName == "Robber")
            {
                //if you no-deal a robber, they kill you
                devilBank.ageSlider.value = 0;
                devilBank.lose            = true;
            }

            print("its not a deal");
            //if no deal, take 10%
            devilBank.EQSlider.value        *= 0.9f;
            devilBank.IQSlider.value        *= 0.9f;
            devilBank.ageSlider.value       *= 0.9f;
            devilBank.wealthSlider.value    *= 0.9f;
            devilBank.happinessSlider.value *= 0.9f;
        }

        EQOffer.value        = 0;
        IQOffer.value        = 0;
        ageOffer.value       = 0;
        wealthOffer.value    = 0;
        happinessOffer.value = 0;
        Change1 = "";
        Change2 = "";
        Change3 = "";
        Change4 = "";
        Change5 = "";
    }