Exemplo n.º 1
0
 /*********************************************/
 /// <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);
 }
Exemplo n.º 2
0
 void Start()
 {
     unitList = GameObject.Find("_Lists").GetComponent<UnitList>();
     shipComponentList = GameObject.Find("_Lists").GetComponent<ShipComponentList>();
 }