Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerInventory : MonoBehaviour
- {
- [SerializeField] private List<string> _items;
- public void AddItem(Item item)
- {
- _items.Add(item.ItemName);
- }
- public void RemoveItem(Item item)
- {
- _items.Remove(item.ItemName);
- }
- public bool HasItem(string itemName)
- {
- if (_items.Contains(itemName))
- {
- _items.Remove(itemName);
- return true;
- }
- else
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement