Example #1
0
 private IEnumerable <IUpdatable> EnumerateUpdatables()
 {
     foreach (IAttachable attachable in AttachedObjects.Where(attachable => attachable is IUpdatable))
     {
         if (attachable is IUpdatable)
         {
             yield return((IUpdatable)attachable);
         }
     }
 }
Example #2
0
        public void Attach(IAttachable attachable)
        {
            if (!AttachedObjects.Contains(attachable))
            {
                AttachedObjects.Add(attachable);
            }

            if (attachable is ICollider)
            {
                _physicsFlag = true;
            }
        }
Example #3
0
        public IEnumerable <IAttachable> GetAttachables(string typeName)
        {
            foreach (IAttachable attachable in AttachedObjects.Where(obj => obj.AttachableType.Name.Equals(typeName)))
            {
                yield return(attachable);
            }

            foreach (IAttachable attachable in AttachedObjects)
            {
                if (attachable.Interfaces.Count(type => type.Name.Equals(typeName)) > 0)
                {
                    yield return(attachable);
                }
            }
        }
Example #4
0
 /// <summary>
 /// Checks if the given Object is already in that Context.
 /// </summary>
 /// <param baseDir="type">Type of Object</param>
 /// <param baseDir="ID">ID</param>
 /// <returns>If ID is InvalidID (Object is not inititalized) then an Exception will be thrown.
 /// If the Object is already in that Context, the Object Instace is returned.
 /// If the Object is not in that Context, null is returned.</returns>
 public override IPersistenceObject ContainsObject(InterfaceType type, int ID)
 {
     CheckDisposed();
     return(AttachedObjects.Where(obj => GetInterfaceType(obj) == type && obj.ID == ID).SingleOrDefault());
 }
Example #5
0
 public IAttachable GetAttachableByName(string name)
 {
     return(AttachedObjects.Where(obj => obj.Name == name).FirstOrDefault());
 }
Example #6
0
 public void Detach(IAttachable attachable)
 {
     AttachedObjects.Remove(attachable);
 }