コード例 #1
0
        /************************************************************************************************************************/

        /// <summary>Ensures that `e` isn't null and adds `method` to its <see cref="DynamicCalls"/>.</summary>
        public static void AddDynamicCall(ref UltEvent <T0, T1> e, Action <T0, T1> method)
        {
            if (e == null)
            {
                e = new UltEvent <T0, T1>();
            }

            e.DynamicCalls += method;
        }
コード例 #2
0
ファイル: UltEvent1.cs プロジェクト: BillSansky/GIC-Demo
        /************************************************************************************************************************/

        #endregion

        /************************************************************************************************************************/

        #region Operators and Call Registration

        /************************************************************************************************************************/

        /// <summary>
        ///     Ensures that 'e' isn't null and adds 'method' to its <see cref="PersistentCalls" /> (if in Edit Mode) or
        ///     <see cref="DynamicCalls" /> (in Play Mode and at runtime).
        /// </summary>
        public static UltEvent <T0> operator +(UltEvent <T0> e, Action <T0> method)
        {
            if (e == null)
            {
                e = new UltEvent <T0>();
            }

#if UNITY_EDITOR
            if (!UnityEditor.EditorApplication.isPlaying && method.Target is Object)
            {
                e.PersistentCalls += method;
                return(e);
            }
#endif

            e.DynamicCalls += method;
            return(e);
        }