diff --git a/Script/WeaponManager.cs b/Script/WeaponManager.cs new file mode 100644 index 0000000..7e7379b --- /dev/null +++ b/Script/WeaponManager.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WeaponManager : MonoBehaviour +{ + public int currentIndex = 0; + public Weapon[] weapons = new Weapon[9]; + int maximum = 2; + Weapon knife; + Weapon sword; + void Start() + { + knife = transform.Find("knife").GetComponent(); + sword = transform.Find("sword").GetComponent(); + weapons[0] = knife; + weapons[1] = sword; + } + public void GetWeapon(int index) + { + weapons[index].gameObject.SetActive(true); + currentIndex = index; + } + public void SetCurrnetWeaponActive(bool value) + { + weapons[currentIndex].gameObject.SetActive(value); + } + public void GetNewWeapon(Weapon newWeapon) + { + weapons[maximum++] = newWeapon; + } +}