|
|
|
|
@ -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<Weapon>();
|
|
|
|
|
sword = transform.Find("sword").GetComponent<Weapon>();
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|