You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
829 B
33 lines
829 B
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;
|
|
}
|
|
}
|