コード例 #1
0
 /// <summary>
 /// 在list中查找可用的Object.
 /// </summary>
 public GameObject FindObjectFromList()
 {
     try
     {
         ObjectManageDt objManageDt = ObjList.Find(
             delegate(ObjectManageDt objTmp)
         {
             return(objTmp.IsUsed == false);
         });
         if (objManageDt != null)
         {
             objManageDt.IsUsed = true;
             return(objManageDt.Obj);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         Debug.LogError("Unity: -> " + ex);
         throw;
     }
 }
コード例 #2
0
    /// <summary>
    /// 添加Object到list.
    /// </summary>
    public void AddObjectToList(GameObject obj)
    {
        ObjectManageDt objManageDt = new ObjectManageDt();

        objManageDt.Obj    = obj;
        objManageDt.IsUsed = false;
        ObjList.Add(objManageDt);
    }
コード例 #3
0
 public void CloseObjectInfoFromList(GameObject obj)
 {
     try
     {
         ObjectManageDt objManageDt = ObjList.Find(
             delegate(ObjectManageDt objTmp)
         {
             return(objTmp.Obj == obj);
         });
         if (objManageDt != null)
         {
             objManageDt.IsUsed = false;
         }
         return;
     }
     catch (Exception ex)
     {
         Debug.LogError("Unity: -> " + ex);
         throw;
     }
 }