Пример #1
0
        /// <summary>
        /// Purchase item
        /// </summary>
        public void Purchase(MItem item)
        {
            if (Data)
            {
                if (Data.Save.Coins - item.Value >= 0)          //If we have money to buy?
                {
                    // Diminish the game controller coins
                    Game_Controller.COINS      -= item.Value;
                    Game_Controller.saveTrigger = true;

                    Data.Save.Coins -= item.Value;

                    // Set the value of the item to 0
                    item.Value = 0;

                    item.Locked = false;                //Unlock the Item

                    // Change the player material
                    player.GetComponent <MeshRenderer>().material = item.gameObject.GetComponent <MeshRenderer>().material;

                    // Change the particle system color
                    player.GetComponent <Paint_Management>().SetParticleSystemColor();
                }
                Data.UpdateData(this);
            }
            else
            {
                item.Locked = false;
                Controller.UpdateLockItems();
            }
        }
Пример #2
0
 /// <summary>
 /// Purchase item
 /// </summary>
 public void Purchase(MItem item)
 {
     Debug.Log("purchased");
     if (Data)
     {
         if (Data.Save.Coins - item.Value >= 0)          //If we have money to buy?
         {
             Data.Save.Coins -= item.Value;
             item.Locked      = false;           //Unlock the Item
         }
         Data.UpdateData(this);
     }
     else
     {
         item.Locked = false;
         // Controller.UpdateLockItems();
     }
 }