Example #1
0
    public void BuyAll()
    {
        player = PlayerManager.playerr;
        int optioncash     = 0;
        int optioncapacity = 0;
        int optionstock    = 0;

        optioncash = Math.Abs((player.TotalCash / FoodListNew.FoodList [BuySellPanelScript.insta].Instance));
        Debug.Log("optioncash is : " + optioncash);
        optionstock = FoodListNew.FoodList [BuySellPanelScript.insta].Stock;
        Debug.Log("optionstock is : " + optionstock);
        optioncapacity = PlayerManager.playerr.MaxCapacity - PlayerManager.playerr.CurrentCapacity;
        Debug.Log("optioncapactiy is : " + optioncapacity);

        maxValue = Math.Min(optioncash, Math.Min(optionstock, optioncapacity));

        cost = (maxValue * FoodListNew.FoodList [BuySellPanelScript.insta].Instance);
        FoodListNew.FoodList [BuySellPanelScript.insta].Stock = FoodListNew.FoodList [BuySellPanelScript.insta].Stock - maxValue;
        player.TotalCash = player.TotalCash - Convert.ToInt32(cost);
        FoodListNew.FoodList [BuySellPanelScript.insta].Owned = Convert.ToInt32(maxValue + FoodListNew.FoodList [BuySellPanelScript.insta].Owned);
        //		FoodListNew.changer++;
        player.NetWorth = player.TotalCash + (FoodListNew.FoodList [BuySellPanelScript.insta].Instance * FoodListNew.FoodList [BuySellPanelScript.insta].Owned);
        InfoScript.changer++;
        FoodListNew.changestock++;
        FoodListNew.changeColor = true;
    }
Example #2
0
    public void Surrender()
    {
        muggingPanel.SetActive(false);
        player = PlayerManager.playerr;
        int twentyPercent = Convert.ToInt32(player.TotalCash * .20);

        PopUpText.newString = ("You surrender all your cash and the thief let you go. - $" + player.TotalCash);
        player.TotalCash    = 0;
        PopUpText.changerPopUp++;
        InfoScript.changer++;
        Mugging.mugged = 1;
    }
Example #3
0
    public void Confirm()
    {
        player = PlayerManager.playerr;
        cost   = (BuySellPanelScript.slider [0].value * FoodListNew.FoodList [BuySellPanelScript.insta].Instance);
        FoodListNew.FoodList [BuySellPanelScript.insta].Stock = FoodListNew.FoodList [BuySellPanelScript.insta].Stock - Convert.ToInt32(BuySellPanelScript.slider [0].value);
        player.TotalCash = player.TotalCash - Convert.ToInt32(cost);
        FoodListNew.FoodList [BuySellPanelScript.insta].Owned = Convert.ToInt32(BuySellPanelScript.slider [0].value + FoodListNew.FoodList [BuySellPanelScript.insta].Owned);
//		FoodListNew.changer++;
        player.NetWorth = player.TotalCash + (FoodListNew.FoodList [BuySellPanelScript.insta].Instance * FoodListNew.FoodList [BuySellPanelScript.insta].Owned);
        InfoScript.changer++;
        FoodListNew.changestock++;
        buySellPanel.SetActive(false);
        FoodListNew.changeColor = true;
    }
Example #4
0
    public void SellAll()
    {
        Debug.Log("ENTERED SELL ALL!");
        player   = PlayerManager.playerr;
        minValue = FoodListNew.FoodList [BuySellPanelScript.insta].Owned;
        //		BuySellPanelScript.updateBuySellPanel();
        cost = (minValue * FoodListNew.FoodList [BuySellPanelScript.insta].Instance);
        FoodListNew.FoodList [BuySellPanelScript.insta].Stock = FoodListNew.FoodList [BuySellPanelScript.insta].Stock + minValue;
        player.TotalCash = player.TotalCash + Convert.ToInt32(cost);
        FoodListNew.FoodList [BuySellPanelScript.insta].Owned = minValue - FoodListNew.FoodList [BuySellPanelScript.insta].Owned;
        player.NetWorth = player.TotalCash + (FoodListNew.FoodList [BuySellPanelScript.insta].Instance * FoodListNew.FoodList [BuySellPanelScript.insta].Owned);
        InfoScript.changer++;
        FoodListNew.changestock++;
        gameObject.GetComponent <AudioSource> ().Play();
//		AudioSource.PlayClipAtPoint(coin, transform.position);
        FoodListNew.changeColor = true;
    }
Example #5
0
    public void Run()
    {
        muggingPanel.SetActive(false);
        player   = PlayerManager.playerr;
        rolldice = UnityEngine.Random.Range(1, 100);
        if (rolldice < 41)
        {
            int fiftyPercent = Convert.ToInt32(player.TotalCash * .50);
            PopUpText.newString = ("You got away, but dropped $" + fiftyPercent);
            player.TotalCash    = player.TotalCash - fiftyPercent;
        }

        if (rolldice > 40)
        {
            PopUpText.newString = ("You got away!");
        }
        PopUpText.changerPopUp++;
        InfoScript.changer++;
        Mugging.mugged = 1;
    }
Example #6
0
    public void Fight()
    {
        muggingPanel.SetActive(false);
        player = PlayerManager.playerr;

        rolldice = UnityEngine.Random.Range(1, 100);
        Debug.Log("Looks like you didnt have a weapon");

        if (rolldice < 10)
        {
            int thirtyPercentNet = Convert.ToInt32(player.NetWorth * .20);
            PopUpText.newString = ("You beat up the thief + $" + thirtyPercentNet);
            player.TotalCash    = player.TotalCash + thirtyPercentNet;
        }
        if (rolldice >= 10 && rolldice < 50)
        {
//			PopUpText.newString = ("The mugger beat you up - $1000");
//			player.TotalCash = player.TotalCash - 1000;
            int twentyPercent = Convert.ToInt32(player.TotalCash * .20);
            PopUpText.newString = ("The thief stabs you - $" + twentyPercent);
            player.TotalCash    = player.TotalCash - twentyPercent;
        }
        if (rolldice >= 50 && rolldice < 99)
        {
            PopUpText.newString = ("You got knocked out, lose 2 days");
            DataManager.days--;
            DataManager.days--;
        }
        if (rolldice > 98)
        {
            PopUpText.newString = ("You stole his gold tooth! + $15,000");
            player.TotalCash    = player.TotalCash + 15000;
        }
        PopUpText.changerPopUp++;
        InfoScript.changer++;
        Mugging.mugged = 1;
    }
    public void changeNetWorth()
    {
        int i           = 0;
        int netSnapshot = 0;

        Debug.Log("inside changeNetWorth");
        foreach (Transform child in transform)
        {
            Price = child.Find("Price").GetComponent <Text>();
            Have  = child.Find("Have").GetComponent <Text>();
//			Food food = new Food ();
//			food = FoodList[i];
            int price        = Convert.ToInt32(Price.text);
            int have         = Convert.ToInt32(Have.text);
            int tempNetWorth = price * have;
            netSnapshot = netSnapshot + tempNetWorth;
            InfoScript.changer++;
            i++;
        }
        player             = PlayerManager.playerr;
        player.NetWorth    = player.TotalCash + netSnapshot;
        changeNetWorthbool = false;
        InfoScript.changer++;
    }