Ejemplo n.º 1
0
    public void IncomePopup()
    {
        PlayerController2 player = GetPlayer(turnNum);

        player.ChangeWealth(incomeLevels[player.GetEducation()]);

        popup.SetButtonNum(1);

        string incomeText = "You collect your income of: $" + incomeLevels[player.GetEducation()];

        if (player.GetRemainingBalance() > 0)
        {
            incomeText += "\nYou make another loan payment of: $" + player.GetPaymentAmount();
            player.MakePayment();
        }

        if (player.HasStocks() && roundNum % 2 == 1)
        {
            incomeText += "\nYour stocks pay out a dividend of: $" + DividendTotal(player);
            player.ChangeWealth(DividendTotal(player));
        }

        popup.title.SetText(incomeText);


        popup.buttons[0].textBox.SetText("Draw Event");
        popup.buttons[0].SetListener(PersonalEventPopup);
        OpenPopup();
    }
Ejemplo n.º 2
0
    public void InheritancePopup()
    {
        PlayerController2 player = GetPlayer(turnNum);
        int inheritance;

        if (player.GetClass() == 0)
        {
            inheritance = 100;
        }
        else if (player.GetClass() == 1)
        {
            inheritance = 200;
        }
        else
        {
            inheritance = 600;
        }

        player.ChangeWealth(inheritance);

        popup.SetButtonNum(1);

        popup.title.SetText("You have inherited: $" + inheritance + "\nFor a total of: $" + player.GetWealth());
        popup.buttons[0].textBox.SetText("Roll for Education");
        popup.buttons[0].SetListener(EducationPopup);
        OpenPopup();
    }
Ejemplo n.º 3
0
    public void SellStock()
    {
        PlayerController2 player = GameManager2.Instance.GetCurrentPlayer();

        if (player.GetStocks(stockIndex) >= amount)
        {
            player.ChangeStocks(stockIndex, -1 * amount);
            player.ChangeWealth(amount * price);
        }
    }
Ejemplo n.º 4
0
    public void BuyStock()
    {
        PlayerController2 player = GameManager2.Instance.GetCurrentPlayer();

        if (player.GetWealth() >= price * amount)
        {
            player.ChangeStocks(stockIndex, amount);
            player.ChangeWealth(-1 * amount * price);
        }
    }
Ejemplo n.º 5
0
    public void PersonalEventPopup()
    {
        PlayerController2 player      = GetPlayer(turnNum);
        EventController   chosenEvent = personalEvents.events[Random.Range(0, personalEvents.events.Count)];

        popup.SetImage(chosenEvent.eventImage);
        popup.title.SetText(chosenEvent.description);

        if (chosenEvent.special == EventController.SpecialEffect.None)
        {
            int effect = chosenEvent.effectsByClass[player.GetClass()];
            popup.buttons[0].textBox.SetText(player.namedClass() + ": $" + effect.ToString());

            player.ChangeWealth(effect);
        }
        else if (chosenEvent.special == EventController.SpecialEffect.Scholarship)
        {
            if (player.GetEducation() < 2)
            {
                player.SetEducation(player.GetEducation() + 1);
                popup.buttons[0].textBox.SetText("Get a Free " + player.namedEducation() + " Degree");
            }
            else
            {
                popup.buttons[0].textBox.SetText("Nothing Happens");
            }
        }
        else if (chosenEvent.special == EventController.SpecialEffect.Divorce)
        {
            player.ChangeWealth(-1 * player.GetWealth() / 2);
            popup.buttons[0].textBox.SetText("Lose Half of your Wealth");
        }

        popup.buttons[0].SetListener(ClosePopup);
        popup.buttons[0].GetOnClick().AddListener(DisableImage);
        OpenPopup();
    }
Ejemplo n.º 6
0
    public void FuneralPopup()
    {
        PlayerController2 player = GetPlayer(turnNum);

        popup.SetButtonNum(1);

        player.ChangeWealth(-1 * funeralCosts[player.GetClass()]);

        string funeralText =
            "We mourn the passing of Player " + turnNum + ", who is survived by their heir, Player " + turnNum + " Jr.\n"
            + "The funeral costs: " + funeralCosts[player.GetClass()];

        if (player.GetRemainingBalance() > 0)
        {
            funeralText += "\nTheir remaining student loan balance of " + player.GetRemainingBalance() + " is taken out of their estate.";
            player.PayRemainingBalance();
        }

        popup.title.SetText(funeralText);

        popup.buttons[0].textBox.SetText("Determine New Class");
        popup.buttons[0].SetListener(NextClassPopup);
    }