示例#1
0
        [NotNull] public IScope Enter(object state = null)
        {
            lock (mLock)
            {
                if (EnterTrigger == ScopeEnterTrigger.Entering)
                {
                    mOnEnter?.Invoke();
                }

                EnteringOverride();
                Entering?.Invoke(this, new EventArgs());

                mStateStack.Push(state);

                Entered?.Invoke(this, new EventArgs());
                EnteredOverride();

                if (EnterTrigger == ScopeEnterTrigger.Entered)
                {
                    mOnEnter?.Invoke();
                }
            }

            return(this);
        }
示例#2
0
 /// <summary>
 /// Called as the object goes from Inactive to Active. Prefer <see cref="Entering"/> if you
 /// are programmatically adding event handlers at runtime. If you are adding event handlers
 /// in the Unity Editor, prefer <see cref="onEntering"/>. If you are waiting for this event
 /// in a subclass of StateController, prefer overriding the <see cref="OnEnable"/> method.
 /// </summary>
 protected virtual void OnEntering()
 {
     if (!skipEvents)
     {
         if (onEntering != null)
         {
             onEntering?.Invoke();
         }
         Entering?.Invoke(this, EventArgs.Empty);
     }
 }
示例#3
0
        internal virtual void OnEntering(IRpcSession session)
        {
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }

            if (Collection.Contains(session))
            {
                return;
            }

            Entering?.Invoke(this, new EventArgs <IRpcSession>(session));
            Collection.Add(session);
        }
示例#4
0
 public virtual void OnEntering(EndPoint endPoint)
 {
     Entering?.Invoke(this, new EventArgs <EndPoint>(endPoint));
 }