Hi,
Sorry, I replied to your other post before seeing this
Typically, I am using PlayMaker for very advanced serious games, and this is not really the problem actually. the problems lies elsewhere, in how PlayMaker supports variables. Indeed you mention this as well, such "delegate to PlayMaker event" action would be unusable in 90% of the cases simply because of variables.
Your pseudo code will end up as a bridge essentially and not a generic one since you must explicitly bind a strongly typed class with playmaker. In that sense this isn't going to remove the need to write a bridge to begin with. Isn't it?
There is nothing wrong with bridges here ( I feel
)
where would your "controller.UpdateMeditationEvent += OnUpdateMeditation;" be? on another monobehaviour right?
typically, this is exactly what I am doing to support Input.touches framework which is heavily based on delegates.
https://hutonggames.fogbugz.com/default.asp?W961if you get that package, you'll see how this is all done.
-- I have a prefab acting as a "singleton", so one per scene, totally isolated
-- It registers to each and every Input.touches delegates
Gesture.onSwipeE += OnSwipe;
-- "OnSwipe" is the following
void OnSwipe(SwipeInfo sw)
{
if (debug)
{
Debug.Log(sw.angle);
}
LastEventPosition = sw.endPoint;
LastSwipeInfo = sw;
PlayMakerFSM.BroadcastEvent("INPUT TOUCHES / SWIPE");
IF you want to target a specific gameobject or FSM to send a local event, it's possible too using my PlayMakerUtils:
http://hutonggames.com/playmakerforum/index.php?topic=3438.msg15764#msg15764in there you will have code like this:
public static void SendEventToGameObject(PlayMakerFSM fromFsm,GameObject target,string fsmEvent,FsmEventData eventData)
{
if (eventData!=null)
{
HutongGames.PlayMaker.Fsm.EventData = eventData;
}
FsmEventTarget _eventTarget = new FsmEventTarget();
_eventTarget.excludeSelf = false;
FsmOwnerDefault owner = new FsmOwnerDefault();
owner.OwnerOption = OwnerDefaultOption.SpecifyGameObject;
owner.GameObject = new FsmGameObject();
owner.GameObject.Value = target;
_eventTarget.gameObject = owner;
_eventTarget.target = FsmEventTarget.EventTarget.GameObject;
_eventTarget.sendToChildren = false;
fromFsm.Fsm.Event(_eventTarget,fsmEvent);
}
Yes, you will need give a reference of an Fsm to fire non global events, but that's easily solved by having an empty ( totally empty, no variables, no logics, no actions, just an empty start state), in your singleton prefab. but that's not really a limitation to provide all these features.
So currently, I think that what you are asking is available. The PlayMakerUtils class may be your missing link I guess.
Am I correctly understanding your situation? what would you want to do differently in this case?
In the case of Photon, the problem is different, Photon framework doesn't provide any delegate, it only sends Unity messages. But that doesn't really make a difference here cause still, Photon and Playmaker will need bridges to communicate together, so I had to create the photon bridge this way. Very much like if you want your character to work with photon, you will have to create specific monobehavior and comply with how photon is working and the way to communicate. Typically, taking PlayMaker out of the equation, you would still need to create bridges between say photon/ngui/GameAnalytics trio. isnt'it? None of these frameworks know about each other, so the only way to make them work together is to create specific codes and act as the middle man ( binding a photon connection message to a gameanalytic event and translate this visually as a text you show on screen using ngui).
Maybe I got carried away this morning
but this is an interesting conversation indeed! so feel free to correct me on my assumptions as for sure, since I am writing a lot of bridges, finding other possibilities is of high interest for me.
bye,
Jean