/*********************************************/ /// <summary> /// 元件索引函数 /// </summary> /// <param name="id">方块ID</param> /// <returns></returns> public T GetUnit <T>(int id, int level) where T : class { if (typeof(T) == typeof(Block)) { return(BlockList.Find((block) => block.Id == id && block.BlockLevel == level) as T); } if (typeof(T) == typeof(ShipComponent)) { return(ShipComponentList.Find((shipComponent) => shipComponent.Id == id && shipComponent.ShipCompoionentLevel == level) as T); } return(null); }
void Start() { unitList = GameObject.Find("_Lists").GetComponent<UnitList>(); shipComponentList = GameObject.Find("_Lists").GetComponent<ShipComponentList>(); }