using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; /// /// 正在使用的工具/材料管理类 /// public class ToolAndmaterialMgr : BaseManager { //该系统所需要使用的全部工器具和材料 public List toolAndMaterialList = new List(); private ToolAndmaterialMgr() { } public void Init(string toolOrMaterilOrDevice) { toolAndMaterialList = GameManager.DataMgr.GetCurrentSystemToolAndMaterials(toolOrMaterilOrDevice); } /// /// 获取指定工具 /// /// /// public D_ToolAndMaterialData GetToolOrMaterialOrDeviceInfoByObjName(string objName) { for (int i = 0; i < toolAndMaterialList.Count; i++) { if (toolAndMaterialList[i].objName == objName) return toolAndMaterialList[i]; } return null; } /// /// 获取ItemInfo /// /// /// public Tool_SelectComponent GetItemInfoByName(string objName) { Tool_SelectComponent tmp= GameObject.FindObjectsOfType().ToList().Find(a => a.gameObject.name == objName); return tmp; } }