Пример #1
0
 // Update is called once per frame
 void Update()
 {
     Text1.GetComponent <Text>().text = "" + PlayerManager.player[0].WatchWallet();
     Text2.GetComponent <Text>().text = "" + PlayerManager.player[1].WatchWallet();
     Text3.GetComponent <Text>().text = "" + PlayerManager.player[2].WatchWallet();
     Text4.GetComponent <Text>().text = "" + PlayerManager.player[3].WatchWallet();
 }
Пример #2
0
    private void Debug()
    {
        Text TextX = Text1.GetComponent <Text>();
        Text TextY = Text2.GetComponent <Text>();
        Text TextZ = Text3.GetComponent <Text>();

        TextX.text = "X : " + TmpX;
        TextY.text = "Y : " + TmpY;
        TextZ.text = "Z : " + TmpZ;
    }
Пример #3
0
    public void Buy()
    {
        if (ItemName == "soda")
        {
            if (BoughtNumber > 0 || soda.sodaBoughtTimes == 1)
            {
                //already have
                if (Text1 != null && Notice1 != null)
                {
                    Text1.GetComponent <Text> ().enabled      = true;
                    Notice1.GetComponent <Image> ().enabled   = true;
                    Notice1.GetComponent <FadeOut> ().enabled = true;
                }
                Debug.Log("you already have one OR bought two times.");
            }
            else
            {
                if (MoneySystem.money >= ItemPrice)
                {
                    MoneySystem.money     = MoneySystem.money - ItemPrice;
                    MoneySystem.MoneyOut  = true;
                    MoneySystem.remainder = MoneySystem.money;
                    SetActiveObject.SetActive(true);
                    SetActiveObject2.SetActive(true);
                    BoughtImage.SetActive(true);
                    BoughtNumber++;
                    save();
                    if (Text3 != null && Notice3 != null)
                    {
                        Text3.GetComponent <Text> ().enabled      = true;
                        Notice3.GetComponent <Image> ().enabled   = true;
                        Notice3.GetComponent <FadeOut> ().enabled = true;
                    }
                    Debug.Log("Buy!");
                }
                else
                {
                    if (Text2 != null && Notice2 != null)
                    {
                        Text2.GetComponent <Text> ().enabled      = true;
                        Notice2.GetComponent <Image> ().enabled   = true;
                        Notice2.GetComponent <FadeOut> ().enabled = true;
                    }
                    //not enough money
                }
            }
        }
        else if (ItemName == "Table" || ItemName == "Cushion" || ItemName == "laundry" || ItemName == "gompang" || ItemName == "mug" || ItemName == "plate" || ItemName == "cake")
        {
            if (BoughtNumber > 0)
            {
                //already have
                if (Text1 != null && Notice1 != null)
                {
                    Text1.GetComponent <Text> ().enabled      = true;
                    Notice1.GetComponent <Image> ().enabled   = true;
                    Notice1.GetComponent <FadeOut> ().enabled = true;
                }
                Debug.Log("you have already one!");
            }
            else
            {
                if (MoneySystem.money >= ItemPrice)
                {
                    MoneySystem.money     = MoneySystem.money - ItemPrice;
                    MoneySystem.MoneyOut  = true;
                    MoneySystem.remainder = MoneySystem.money;
                    SetActiveObject.SetActive(true);
                    SetActiveObject2.SetActive(true);
                    BoughtImage.SetActive(true);
                    BoughtNumber++;
                    save();
                    if (Text3 != null && Notice3 != null)
                    {
                        Text3.GetComponent <Text> ().enabled      = true;
                        Notice3.GetComponent <Image> ().enabled   = true;
                        Notice3.GetComponent <FadeOut> ().enabled = true;
                    }
                    Debug.Log("Buy!");
                }
                else
                {
                    //not enough money
                    if (Text2 != null && Notice2 != null)
                    {
                        Text2.GetComponent <Text> ().enabled      = true;
                        Notice2.GetComponent <Image> ().enabled   = true;
                        Notice2.GetComponent <FadeOut> ().enabled = true;
                    }
                }
            }
        }
        else                    // basic item
        {
            if (MoneySystem.money >= ItemPrice)
            {
                MoneySystem.money    = MoneySystem.money - ItemPrice;
                MoneySystem.MoneyOut = true;
//				MoneySystem.ContentsName = ItemName;
//				MoneySystem.outcome = -ItemPrice;
                MoneySystem.remainder = MoneySystem.money;
                //SetActiveObject.GetComponent<Image> ().enabled = true;
                SetActiveObject.SetActive(true);
                SetActiveObject2.SetActive(true);
                BoughtImage.SetActive(true);
                BoughtNumber++;
                save();
                if (Text3 != null && Notice3 != null)
                {
                    Text3.GetComponent <Text> ().enabled      = true;
                    Notice3.GetComponent <Image> ().enabled   = true;
                    Notice3.GetComponent <FadeOut> ().enabled = true;
                }
                Debug.Log("Buy!");
            }
            else
            {
                //not enough money
                if (Text2 != null && Notice2 != null)
                {
                    Text2.GetComponent <Text> ().enabled      = true;
                    Notice2.GetComponent <Image> ().enabled   = true;
                    Notice2.GetComponent <FadeOut> ().enabled = true;
                }
                Debug.Log("Be short of money");
            }
        }
    }