using System.Collections; using System.Collections.Generic; using UnityEngine; public partial class PlayerManager : Singleton { // 持有的物品 public List items { get { return m_Items; } } private List m_Items = new List(); // 当前选中的物品 ItemBase m_CurrentItem = null; void InitItems() { m_Items.Add(new Item_B2Phone()); m_Items.Add(new Item_SpaceBeamer()); } /// /// 选中物品 /// public void SetCurrentItem(ItemBase item) { if (!items.Contains(item)) { Debug.LogError("No such item"); return; } m_CurrentItem = item; } /// /// 使用当前道具 /// public void UseCurrentItem() { if (m_CurrentItem == null) return; m_CurrentItem.OnUse(m_Crew.gameObject); } void UpdateItems() { for(int i = 0; i < items.Count; ++i) { items[i].Update(); } } }