public SpacialElementFunction(SpacialElement target)
        {
            this.Element = target;

            if (target.Lifetime.IsExpired)
            {
                return;
            }

            if (target.IsAttached())
            {
                Time.CurrentTime.QueueAction(GetType().Name + "AttachTo(" + target.GetType().Name + ")", () =>
                {
                    if (target.Lifetime.IsExpired == false && target.IsAttached())
                    {
                        Time.CurrentTime.Add(this);
                    }
                });
            }
            else
            {
                target.Added.SubscribeForLifetime(() => { Time.CurrentTime.Add(this); }, target.Lifetime);
            }


            Element.Lifetime.OnDisposed(() =>
            {
                if (this.Lifetime.IsExpired == false)
                {
                    this.Lifetime.Dispose();
                }
            });
        }
Esempio n. 2
0
 private bool IsIncluded(SpacialElement e)
 {
     if (ExcludedTypes == null)
     {
         return(true);
     }
     else
     {
         return(ExcludedTypes.Contains(e.GetType()) == false);
     }
 }