public void AddItem(StoredItem s, bool quiet)
 {
     items.AddItem(s);
     if (inInventory)
     {
         inventoryUI.PopulateItems(this.items);
     }
     s.item.OnPickup(quiet);
     UpdateMoneyUI();
 }
 public void AddItem(InventoryItem item)
 {
     SoundManager.ItemGetSound();
     items.AddItem(item);
     if (inInventory)
     {
         inventoryUI.PopulateItems(this.items);
     }
     item.OnPickup();
     UpdateMoneyUI();
 }
Exemple #3
0
 public void AddObjectOne()
 {
     Inventory.AddItem(ObjectOne);
 }
        void Update()
        {
            if (Global.USER_INPUT_ENABLED)
            {
                if (!m_Jump && CrossPlatformInputManager.GetButtonDown("Jump")) //If we are not currently performing a jump...
                {
                    if (m_StaminaSystem.AttemptJump())
                    {
                        m_Jump = true;
                    }
                    else
                    {
                        m_Jump = false;
                    }
                }

                //UNDER CONSTRUCTION
                //if (m_AutoRunPressed = CrossPlatformInputManager.GetButtonDown("AutoRun"))
                //{
                //    m_isAutoRunning = !m_isAutoRunning;
                //}

                //check if trying to interact with an npc or an item.
                if (CrossPlatformInputManager.GetButtonDown("Interact"))
                {
                    //it's an NPC
                    if (m_PersonRequestingToBeSpokenWith != null)
                    {
                        if (!alreadySpeaking)
                        {//!!ORDER IS IMPORTANT HERE!!\\
                            alreadySpeaking = true;
                            SetPlayerPositionForConversation();
                            m_PersonRequestingToBeSpokenWith.GetComponent <Interactable>().Interact();
                        }
                        else
                        {
                            //you're talking
                        }
                    }

                    //its an item
                    if (mItemRequestingToBeCollected != null)
                    {
                        animator.SetTrigger("Pickup");
                        //mItemRequestingToBeCollected.GetDetailsAboutItem();
                        inventory.AddItem(mItemRequestingToBeCollected);
                        //OnPickup() destroys rigidbody
                        mItemRequestingToBeCollected.OnPickup();

                        if (hud.IsMessagePanelOpened)
                        {
                            hud.CloseMessagePanel();
                        }
                        mItemRequestingToBeCollected = null;
                    }
                    else
                    {
                        Debug.Log("item is null or not able to be collected");
                    }
                }
                if (CrossPlatformInputManager.GetButtonDown("SelfHeal"))
                {
                    m_SpecialAbilities.AttemptSpecialAbility(0, this.gameObject);
                }
                if (CrossPlatformInputManager.GetButtonDown("AOE"))
                {
                    m_SpecialAbilities.AttemptSpecialAbility(1, this.gameObject);
                }
                if (CrossPlatformInputManager.GetButtonDown("PowerAttack"))
                {
                    m_SpecialAbilities.AttemptSpecialAbility(2, m_WeaponSystem.GetCurrentTarget());
                }
            }
        }