예제 #1
0
파일: Item.cs 프로젝트: SNUGDC/HomeAlone
 public void increaseItem()
 {
     SetActiveObject.SetActive(true);
     SetActiveObject2.SetActive(true);
     BoughtImage.SetActive(true);
     BoughtNumber++;
     save();
 }
예제 #2
0
파일: Item.cs 프로젝트: SNUGDC/HomeAlone
 // Update is called once per frame
 void Update()
 {
     if (BoughtNumber == 0)
     {
         BoughtImage.SetActive(false);
     }
     if (BoughtNumber > 0 && ItemName != "soda" && ItemName != "Table" && ItemName != "Cushion" && ItemName != "laundry" && ItemName != "gompang" && ItemName != "mug" && ItemName != "plate" && ItemName != "cake")
     {
         BoughtImage.SetActive(true);
         HavingNumber.text = ((int)SetActiveObject2.GetComponent <StrawberryMilk> ().RemainTime.TotalHours).ToString() + "시간 " + SetActiveObject2.GetComponent <StrawberryMilk> ().RemainTime.Minutes.ToString() + "분 남음";
     }
     else if (ItemName == "soda" && soda.sodaBoughtTimes == 2)
     {
         HavingNumber.text = "구매 불가";
     }
 }
예제 #3
0
파일: Item.cs 프로젝트: SNUGDC/HomeAlone
    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");
            }
        }
    }