コード例 #1
0
        private static void Test()
        {
            UnityEvent    ev   = default;
            CharacterBody body = default;

            ev.AddPersistentListener(body, (b) => b.RecalculateStats());
        }
コード例 #2
0
ファイル: SignalUtility.cs プロジェクト: 0geova0/Jam
 public static void AddNewReaction(this SignalReceiver receiver, SignalAsset signalAsset)
 {
     if (signalAsset != null && receiver != null)
     {
         Undo.RecordObject(receiver, Styles.UndoAddReaction);
         var newEvent = new UnityEvent();
         newEvent.AddPersistentListener();
         var evtIndex = newEvent.GetPersistentEventCount() - 1;
         newEvent.RegisterVoidPersistentListenerWithoutValidation(evtIndex, receiver.gameObject, string.Empty);
         receiver.AddReaction(signalAsset, newEvent);
         PrefabUtility.RecordPrefabInstancePropertyModifications(receiver);
     }
 }
コード例 #3
0
        public static void AddNewReaction(this SignalReceiver receiver, SignalAsset signalAsset)
        {
            if (signalAsset != null && receiver != null)
            {
                Undo.RegisterCompleteObjectUndo(receiver, Styles.UndoAddReaction);

                var newEvent = new UnityEvent();
                newEvent.AddPersistentListener();
                var evtIndex = newEvent.GetPersistentEventCount() - 1;
                newEvent.RegisterVoidPersistentListenerWithoutValidation(evtIndex, receiver.gameObject, string.Empty);
                receiver.AddReaction(signalAsset, newEvent);
            }
        }
コード例 #4
0
 public static void AddPersistentListener <T0, T1, T2, T3>(UnityEvent <T0, T1, T2, T3> unityEvent, UnityAction <T0, T1, T2, T3> call)
 {
     unityEvent.AddPersistentListener(call);
 }
コード例 #5
0
 public static void AddPersistentListener(UnityEvent unityEvent, UnityAction call)
 {
     unityEvent.AddPersistentListener(call);
 }