private void EatChocolateOnKeyPress() { if (!ResourceManager.instance.HasResource(chocolate.itemId)) { return; } _playerHealth.AddHealth(chocolate.healthAmount); ResourceManager.instance.UseResource(chocolate.itemId); InventoryManager.instance.CloseInventory(); InventoryManager.instance.ClearItemSelection(); }
public void HandleShopItemInfluence(PlayerModifierTypes.ShopItemInfo shopItemInfo) { switch (shopItemInfo.shopItem) { case PlayerModifierTypes.ShopItem.HealthPotion: { float potionHealthAmount = shopItemInfo.valueChange; _playerHealthSetter.AddHealth(potionHealthAmount); } break; case PlayerModifierTypes.ShopItem.BulletsFreezeEnemy: _playerShooting.BuyFreezingBullet(); break; case PlayerModifierTypes.ShopItem.ShotGun: _playerShooting.UnlockWeapon(PlayerShooting.WeaponType.Shotgun); break; case PlayerModifierTypes.ShopItem.ChargeGun: _playerShooting.UnlockWeapon(PlayerShooting.WeaponType.ChargeGun); break; default: throw new ArgumentOutOfRangeException(nameof(shopItemInfo.shopItem), shopItemInfo.shopItem, null); } }