コード例 #1
0
 public void DeleteItem(int _itemID)
 {
     inventorySCR.DeleteItem(_itemID);
     RefreshDisplays();
     inventorySCR.AddItemToInventory(_itemID);
     gameObject.SetActive(false);
 }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        ItemInventory player = other.gameObject.GetComponent <ItemInventory>();

        if (player != null && inventoryItem.GetComponent <ItemData>() != null)
        {
            player.AddItemToInventory(inventoryItem.GetComponent <ItemData>());
            Destroy(gameObject);
        }
    }
コード例 #3
0
    private void OnTriggerEnter(Collider other)
    {
        ItemInventory player = other.gameObject.GetComponent <ItemInventory>();

        //StateManager playerA = collision.gameObject.GetComponent<StateManager>();
        if (player != null && inventoryItem.GetComponent <GrapplingHook>() != null)
        {
            player.AddItemToInventory(inventoryItem.GetComponent <GrapplingHook>());
            //instantiate the weapon model in the players hand set inactive to be invisible.
            player.AddItemModel(this, inventoryItem.GetComponent <GrapplingHook>(), player.hardpointsManager.Hardpoints, player.hand);
            Destroy(gameObject);
        }
    }
コード例 #4
0
 public void ClaimReward()
 {
     if (goldReward > 0)
     {
         playerStats.GainGold(goldReward);
     }
     if (foodReward > 0)
     {
         playerStats.GainFood(foodReward);
     }
     if (cannonballReward > 0)
     {
         playerStats.GainCannonball(cannonballReward);
     }
     if (itemReward != null)
     {
         inventory.AddItemToInventory(itemReward.itemID);
     }
 }
コード例 #5
0
 public void BuyWeapon(int itemID)
 {
     inventory.AddItemToInventory(itemID);
 }