private void getPurchaseSystemManager()
 {
     if (m_purchase_system == null)
     {
         m_purchase_system = PurchaseSystemManager.GetInstance();
     }
 }
Exemplo n.º 2
0
    public static void ChanceToAwardFreeItem(string item_key, float chance_to_award)
    {
        Debug.Log("Chance to award free");
        float randy = UnityEngine.Random.Range(0.0f, 1.0f);

        if (randy < chance_to_award)
        {
            PurchasableItem free_item = PurchaseSystemManager.GetInstance().getPurchasableItemByKey(item_key);
            Debug.Log("Awarding " + free_item.visible_name);

            string free_item_notification = string.Format(FREE_ITEM_AWARDED, free_item.visible_name);
            ModalSystemManager.GetInstance().showSingleButtonModal(free_item_notification);

            //call any on_purchase methods specified
            if (free_item.on_purchase_methods != null)
            {
                MethodCallUtility.CallOnPurchaseMethods(free_item.on_purchase_methods);
            }
        }
    }