Example #1
0
    public void SellStock()
    {
        PlayerController2 player = GameManager2.Instance.GetCurrentPlayer();

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

        if (player.GetWealth() >= price * amount)
        {
            player.ChangeStocks(stockIndex, amount);
            player.ChangeWealth(-1 * amount * price);
        }
    }