using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 战斗武器 /// public class BattleWeapon : MonoBehaviour { /// /// 武器列表 /// public List m_Weapons = new List(); /// /// 武器特效列表 /// public List m_WeaponEffects = new List(); /// /// 设置武器 /// /// 武器ID public void SetWeapon(int id) { int index = 0; if (3000002 == id) { index = 1; } if (index >= 0 && index < m_Weapons.Count) { for (int i = 0; i < m_Weapons.Count; i++) { if (i == index) { m_Weapons[i].SetActive(true); } else { m_Weapons[i].SetActive(false); } } } } /// /// 设置武器特效 /// /// 武器ID public void SetWeaponEffect(int id) { // 关闭所有特效 for (int i = 0; i < m_WeaponEffects.Count; i++) { m_WeaponEffects[i].SetActive(false); } if (id <= 0) { return; } int index = 0; // 火弓用火独有的 if (3000002 == id) { index = 1; } if (index >= 0 && index < m_WeaponEffects.Count) { for (int i = 0; i < m_WeaponEffects.Count; i++) { if (i == index) { m_WeaponEffects[i].SetActive(true); } else { m_WeaponEffects[i].SetActive(false); } } } } //// Use this for initialization //void Start() //{ //} //// Update is called once per frame //void Update() //{ //} }