public GameObject GetObject(IGameObjectContainer objectContainer)
        {
            if (ObjectType == TYPE_ID && ObjectId > -1 && ObjectId < objectContainer.Objects.Count)
            {
                return(objectContainer.Objects[ObjectId]);
            }

            return(null);
        }
Пример #2
0
        public static GameObject GetObject(this IGameObjectContainer self, ObjectReference reference)
        {
            if (reference == null || reference.ObjectType != ObjectReference.TYPE_ID)
            {
                return(null);
            }

            if (reference.ObjectId > -1 && reference.ObjectId < self.Objects.Count)
            {
                return(self.Objects.ElementAt(reference.ObjectId));
            }
            else
            {
                return(null);
            }
        }
    public List <GameObject> FindAll(Func <GameObject, bool> del)
    {
        List <GameObject> result = new List <GameObject>();

        foreach (GameObject obj in children)
        {
            if (obj != null)
            {
                if (del.Invoke(obj))
                {
                    result.Add(obj);
                }
                if (obj is IGameObjectContainer)
                {
                    IGameObjectContainer objContainer = obj as IGameObjectContainer;
                    result.AddRange(objContainer.FindAll(del));
                }
            }
        }
        return(result);
    }
 public GameObject Find(Func <GameObject, bool> del)
 {
     foreach (GameObject obj in children)
     {
         if (obj != null)
         {
             if (del.Invoke(obj))
             {
                 return(obj);
             }
             else if (obj is IGameObjectContainer)
             {
                 IGameObjectContainer objContainer = obj as IGameObjectContainer;
                 GameObject           subObj       = objContainer.Find(del);
                 if (subObj != null)
                 {
                     return(subObj);
                 }
             }
         }
     }
     return(null);
 }
 public static GameObject Find(this IGameObjectContainer container, string id)
 {
     return(container.Find((gobj) => gobj != null && gobj.Id == id));
 }