maint: renamed player folder to units to match namespaces. added unit class as well.
This commit is contained in:
47
Assets/Scripts/Units/Inventory.cs
Normal file
47
Assets/Scripts/Units/Inventory.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Collections.Generic;
|
||||
using NodeCanvas.Tasks.Actions;
|
||||
using Reset.Items;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reset.Units{
|
||||
public class Inventory : MonoBehaviour{
|
||||
public Weapon rangedWeapon;
|
||||
public Weapon meleeWeapon;
|
||||
|
||||
public Ability spellAbility1;
|
||||
public Ability spellAbility2;
|
||||
|
||||
public Ability toolAbility1;
|
||||
public Ability toolAbility2;
|
||||
|
||||
public List<Item> storedItems = new List<Item>(15);
|
||||
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
public void AddToInventory(Item newItem){
|
||||
storedItems.Add(newItem);
|
||||
}
|
||||
|
||||
public void Equip(Item item){
|
||||
if (item is not IEquipable) {
|
||||
Debug.LogError("This item is not equippable.", item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item is Weapon thisWeapon) {
|
||||
if (meleeWeapon != null) {
|
||||
storedItems.Add(meleeWeapon);
|
||||
}
|
||||
|
||||
meleeWeapon = thisWeapon;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user