Exemplo n.º 1
0
            public override void TriggerEventToGameObjectPlaymakerFSMs(string eventName, GameObject destination, GameObject source, bool skipEventManagers)
            {
                var FSMs = destination.GetComponents <PlayMakerFSM>();

                if (FSMs != null && FSMs.GetLength(0) > 0)
                {
                    foreach (var fsmComponent in FSMs)
                    {
                        customSource = source;
                        if (skipEventManagers)
                        {
                            ExcludedEventManagerObjects.Add(destination);
                        }
                        try
                        {
                            fsmComponent.Fsm.Event(eventName);
                        }
                        finally
                        {
                            if (customSource == source)
                            {
                                customSource = null;
                            }
                            if (skipEventManagers)
                            {
                                ExcludedEventManagerObjects.Remove(destination);
                            }
                        }
                    }
                }
            }
Exemplo n.º 2
0
 public override void BroadcastToPlaymakerFSMs(string eventName, GameObject source, bool skipEventManagers)
 {
     if (PlayMakerFSM.FsmList.Count > 0)
     {
         foreach (var fsmComponent in PlayMakerFSM.FsmList)
         {
             if (fsmComponent.Fsm != null)
             {
                 customSource = source;
                 if (skipEventManagers)
                 {
                     skipEventManagerBroadcast = true;
                     ExcludedEventManagerObjects.Add(fsmComponent.gameObject);
                 }
                 try
                 {
                     fsmComponent.Fsm.Event(eventName);
                 }
                 finally
                 {
                     if (customSource == source)
                     {
                         customSource = null;
                     }
                     if (skipEventManagers)
                     {
                         skipEventManagerBroadcast = false;
                         ExcludedEventManagerObjects.Remove(fsmComponent.gameObject);
                     }
                 }
             }
         }
     }
 }