public static void SendEventToGameObject(PlayMakerFSM fromFsm,GameObject target,string fsmEvent,bool includeChildren,FsmEventData eventData) { if (eventData!=null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } if (fromFsm == null) { return; } 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 = includeChildren; fromFsm.Fsm.Event(_eventTarget,fsmEvent); }
private void SendEventToGameObject(string fsmEvent, bool includeChildren, FsmEventData eventData) { if (eventData != null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } if (cachedFsm == null) { return; } FsmEventTarget _eventTarget = new FsmEventTarget(); _eventTarget.excludeSelf = false; _eventTarget.sendToChildren = includeChildren; _eventTarget.target = FsmEventTarget.EventTarget.GameObject; FsmOwnerDefault owner = new FsmOwnerDefault(); owner.OwnerOption = OwnerDefaultOption.SpecifyGameObject; owner.GameObject = new FsmGameObject(); owner.GameObject.Value = this.gameObject; _eventTarget.gameObject = owner; cachedFsm.Fsm.Event(_eventTarget, fsmEvent); }
void SendEvent() { FsmEventData eventData = new FsmEventData(); eventData.StringData = myData; 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 = fsm.gameObject; _eventTarget.gameObject = owner; _eventTarget.fsmComponent = fsm; _eventTarget.target = FsmEventTarget.EventTarget.GameObjectFSM; _eventTarget.sendToChildren = false; fsm.Fsm.Event(_eventTarget, eventName); }
void FirePlayMakerEvent(FsmEventData eventData) { // if (eventData!=null) // { // HutongGames.PlayMaker.Fsm.EventData = eventData; // } fsmEventTarget.excludeSelf = false; // not available in this context, only when even ti sfired from an Fsm. fsmEventTarget.sendToChildren = fsmEventSetup.sendtoChildren; // if (PlayMakerUGuiSceneProxy.fsm == null) // { // Debug.LogError("Missing 'PlayMaker UGui' prefab in scene"); // return; // } //Fsm _fsm = PlayMakerUGuiSceneProxy.fsm.Fsm; if (debug) { Debug.Log("Fire event: " + GetEventString()); } //_fsm.Event(fsmEventTarget,GetEventString()); PlayMakerUtils.SendEventToTarget(PlayMakerUGuiSceneProxy.fsm, fsmEventTarget, GetEventString(), eventData); }
void OnParticleCollision(GameObject other) { ParticleSystem particleSystem; particleSystem = other.GetComponent<ParticleSystem>(); int safeLength = particleSystem.safeCollisionEventSize; // if (collisionEvents.Length < safeLength) collisionEvents = new ParticleSystem.CollisionEvent[safeLength]; int numCollisionEvents = particleSystem.GetCollisionEvents(gameObject, collisionEvents); FsmEventData _data = new FsmEventData(); _data.GameObjectData = other; _data.IntData = numCollisionEvents; PlayMakerUtils.SendEventToGameObject(_fsm,this.gameObject,"ON PARTICLE COLLISION"); /* int i = 0; while (i < numCollisionEvents) { if (gameObject.rigidbody) { Vector3 pos = collisionEvents[i].intersection; Vector3 force = collisionEvents[i].velocity * 10; gameObject.rigidbody.AddForce(force); } i++; } */ }
void onControllerEndReached(CurvySplineMoveEventArgs e) { FsmEventData eventData = new FsmEventData(); _OnEndReachedEventData = e; this.FirePlayMakerEvent(SplineControllerOnEndReached, splineControllerOnEndReachedTarget, eventData); e = _OnEndReachedEventData; }
/// <summary> /// this callback is triggered right after the activity in /// question has been approved for activation. /// It Broadcasts a global event related to that activity /// </summary> protected virtual void OnStart_Earthquake() { FsmEventData eventData = new FsmEventData(); eventData.Vector3Data = (Vector3)m_Player.SetWeapon.Argument; HutongGames.PlayMaker.Fsm.EventData = eventData; PlayMakerFSM.BroadcastEvent(GetActivityStartEvent("Earthquake")); }
/// <summary> /// this callback is triggered right after the activity in /// question has been approved for activation. /// It Broadcasts a global event related to that activity /// </summary> protected virtual void OnStart_SetWeapon() { FsmEventData eventData = new FsmEventData(); eventData.IntData = (int)m_Player.SetWeapon.Argument; HutongGames.PlayMaker.Fsm.EventData = eventData; PlayMakerFSM.BroadcastEvent(GetActivityStartEvent("Set Weapon")); }
protected void OnClick() { if (debug) { Debug.Log("OnClick"); } FsmEventData _eventData = new FsmEventData(); this.FirePlayMakerEvent(_eventData); }
protected void OnClick() { if (debug) { Debug.Log("OnClick"); } FsmEventData _eventData = HutongGames.PlayMaker.Fsm.EventData; this.FirePlayMakerEvent(_eventData); }
// CALLBACK private void OnEvent(SelectorItem i_EventData) { if (i_EventData == null) { return; } FsmEventData fsmEventData = new FsmEventData(); fsmEventData.IntData = i_EventData.id; FireEvent(fsmEventData); }
void FirePlayMakerEvent(FsmEventData eventData) { fsmEventTarget.excludeSelf = false; // not available in this context, only when even ti sfired from an Fsm. fsmEventTarget.sendToChildren = fsmEventSetup.sendtoChildren; if (debug) { Debug.Log("Fire event: " + GetEventString()); } PlayMakerUtils.SendEventToTarget(null, fsmEventTarget, GetEventString(), eventData); }
public static void SendEvent(GameObject i_Target, string i_EventName, FsmEventData i_EventData = null) { if (i_Target == null) { return; } if (i_EventData != null) { HutongGames.PlayMaker.Fsm.EventData = i_EventData; } NotifyEvent(i_Target, i_EventName); }
protected void OnValueChanged(float value) { if (debug) { Debug.Log("OnValueChanged(float): " + value); } if (action == ActionType.SendFsmEvent) { FsmEventData _eventData = new FsmEventData(); _eventData.FloatData = value; FirePlayMakerEvent(_eventData); } else { SetFsmVariable(value); } }
protected void OnValueChanged(Vector2 value) { if (debug) { Debug.Log("OnValueChanged(vector2): " + value); } if (action == ActionType.SendFsmEvent) { FsmEventData _eventData = HutongGames.PlayMaker.Fsm.EventData; _eventData.Vector2Data = value; FirePlayMakerEvent(_eventData); } else { SetFsmVariable(value); } }
protected void onEndEdit(string value) { if (debug) { Debug.Log("onEndEdit(string): " + value); } if (action == ActionType.SendFsmEvent) { FsmEventData _eventData = new FsmEventData(); _eventData.StringData = value; FirePlayMakerEvent(_eventData); } else { SetFsmVariable(value); } }
}// OnPhotonInstantiate /// <summary> /// Sends the photon instantiation fsm event to ALL Fsm of the instantiated gameObject AND its children. /// </summary> void sendPhotonInstantiationFsmEvent() { string _fsmEvent = PlayMakerPunLUT.CallbacksEvents[PunCallbacks.OnPhotonInstantiate]; if (debug) { Debug.Log("sending " + _fsmEvent + " event to " + this.gameObject.name); } // set the target to be this gameObject. FsmOwnerDefault goTarget = new FsmOwnerDefault(); goTarget.GameObject = new FsmGameObject(); goTarget.GameObject.Value = this.gameObject; goTarget.OwnerOption = OwnerDefaultOption.SpecifyGameObject; // send the event to this gameObject and all its children FsmEventTarget eventTarget = new FsmEventTarget(); eventTarget.excludeSelf = false; eventTarget.target = FsmEventTarget.EventTarget.GameObject; eventTarget.gameObject = goTarget; eventTarget.sendToChildren = true; // create the event. FsmEvent fsmEvent = new FsmEvent(_fsmEvent); string _data = "<color=darkblue>" + "ActorNumber" + "</color>=<color=<darkblue>" + _lastCallbackInfo.Sender.ActorNumber + "</color> "; _data += "<color=darkblue>" + "NickName" + "</color>=<color=<darkblue>" + _lastCallbackInfo.Sender.NickName + "</color> "; Debug.Log("PlayMakerPhotonGameObjectProxy Received Callback <color=fuchsia>" + PunCallbacks.OnPhotonInstantiate + "</color> " + "Broadcasting global Event <color=fuchsia>" + fsmEvent.Name + "</color>\n" + _data , this); FsmEventData _d = new FsmEventData(); _d.StringData = _lastCallbackInfo.Sender.NickName; _d.IntData = _lastCallbackInfo.Sender.ActorNumber; PlayMakerUtils.SendEventToTarget(null, eventTarget, fsmEvent.Name, _d); }// sendPhotonInstantiationFsmEvent
protected void onEndEdit(string value) { if (debug) { Debug.Log("onEndEdit(string): " + value); } if (action == ActionType.SendFsmEvent) { FsmEventData _eventData = HutongGames.PlayMaker.Fsm.EventData; _eventData.StringData = value; _eventData.BoolData = inputField.wasCanceled; FirePlayMakerEvent(_eventData); } else { SetFsmVariable(value); } }
private void FireEvent(FsmEventData i_EventData) { if (i_EventData == null) { return; } Fsm.EventData = i_EventData; if (PlayMakerUGuiSceneProxy.fsm == null) { Debug.LogError("Missing 'PlayMaker UGui' prefab in scene."); return; } m_FsmEventTarget.excludeSelf = false; // Why? Fsm fsm = PlayMakerUGuiSceneProxy.fsm.Fsm; fsm.Event(m_FsmEventTarget, m_FsmEventSetup.eventName); }
void OnParticleCollision(GameObject other) { ParticleSystem particleSystem; particleSystem = other.GetComponent <ParticleSystem>(); int safeLength = particleSystem.GetSafeCollisionEventSize(); // if (collisionEvents.Length < safeLength) collisionEvents = new ParticleCollisionEvent[safeLength]; int numCollisionEvents = particleSystem.GetCollisionEvents(gameObject, collisionEvents); FsmEventData _data = new FsmEventData(); _data.GameObjectData = other; _data.IntData = numCollisionEvents; PlayMakerUtils.SendEventToGameObject(_fsm, this.gameObject, "ON PARTICLE COLLISION"); /* * * int i = 0; * while (i < numCollisionEvents) { * if (gameObject.rigidbody) { * Vector3 pos = collisionEvents[i].intersection; * Vector3 force = collisionEvents[i].velocity * 10; * gameObject.rigidbody.AddForce(force); * } * i++; * } * */ }
void FirePlayMakerEvent(FsmEventData eventData) { if (eventData != null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } fsmEventTarget.excludeSelf = false; // _eventTarget.sendToChildren = false; if (PlayMakerUGuiSceneProxy.fsm == null) { Debug.LogError("Missing 'PlayMaker UGui' prefab in scene"); return; } Fsm _fsm = PlayMakerUGuiSceneProxy.fsm.Fsm; if (debug) { Debug.Log("Fire event: " + GetEventString()); } _fsm.Event(fsmEventTarget, GetEventString()); }
public static void FirePlayMakerEvent(PlayMakerFSM i_Source, string i_EventName, GameObject i_Target, FsmEventData i_EventData) { if (i_EventData != null) { HutongGames.PlayMaker.Fsm.EventData = i_EventData; } if (i_Source == null) { return; } FsmEventTarget eventTarget = new FsmEventTarget(); eventTarget.excludeSelf = false; eventTarget.sendToChildren = true; eventTarget.target = FsmEventTarget.EventTarget.GameObject; FsmOwnerDefault owner = new FsmOwnerDefault(); owner.OwnerOption = OwnerDefaultOption.SpecifyGameObject; owner.GameObject = new FsmGameObject(); owner.GameObject.Value = i_Target; eventTarget.gameObject = owner; i_Source.Fsm.Event(eventTarget, i_EventName); }
// CALLBACK private void OnEvent() { FsmEventData fsmEventData = new FsmEventData(); FireEvent(fsmEventData); }
public static void SendEventToGameObject(PlayMakerFSM fromFsm, GameObject target, string fsmEvent, FsmEventData eventData) { if (eventData != null) { Fsm.EventData = eventData; } FsmEventTarget fsmEventTarget = new FsmEventTarget(); fsmEventTarget.excludeSelf = false; fsmEventTarget.gameObject = new FsmOwnerDefault { OwnerOption = OwnerDefaultOption.SpecifyGameObject, GameObject = new FsmGameObject(), GameObject = { Value = target } }; fsmEventTarget.target = FsmEventTarget.EventTarget.GameObject; fsmEventTarget.sendToChildren = false; fromFsm.Fsm.Event(fsmEventTarget, fsmEvent); }
public static void SendEventToGameObject(PlayMakerFSM fromFsm, GameObject target, string fsmEvent, bool includeChildren, FsmEventData eventData) { if (fromFsm == null) { fromFsm = GetFsmEventSender(); } if (eventData != null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } if (fromFsm == null) { return; } FsmEventTarget _eventTarget = new FsmEventTarget(); _eventTarget.excludeSelf = false; _eventTarget.sendToChildren = includeChildren; _eventTarget.target = FsmEventTarget.EventTarget.GameObject; FsmOwnerDefault owner = new FsmOwnerDefault(); owner.OwnerOption = OwnerDefaultOption.SpecifyGameObject; owner.GameObject = new FsmGameObject(); owner.GameObject.Value = target; _eventTarget.gameObject = owner; fromFsm.Fsm.Event(_eventTarget, fsmEvent); }
public static void SendEventToGameObjectFsmByName(PlayMakerFSM fromFsm, GameObject target, string fsmName, string fsmEvent, FsmEventData eventData) { FsmEventTarget _target = new FsmEventTarget(); _target.target = FsmEventTarget.EventTarget.GameObjectFSM; _target.gameObject = new FsmOwnerDefault(); _target.gameObject.OwnerOption = OwnerDefaultOption.SpecifyGameObject; _target.gameObject.GameObject = target; _target.fsmName = fsmName; SendEventToTarget(fromFsm, _target, fsmEvent, eventData); }
public static void SendEventToTarget(PlayMakerFSM fromFsm, FsmEventTarget target, string fsmEvent, FsmEventData eventData) { if (fromFsm == null) { fromFsm = GetFsmEventSender(); } if (eventData != null) { Fsm.EventData = eventData; } if (fromFsm == null) { return; } fromFsm.Fsm.Event(target, fsmEvent); }
public static void SendEventToGameObject(PlayMakerFSM fromFsm, GameObject target, string fsmEvent, FsmEventData eventData) { SendEventToGameObject(fromFsm, target, fsmEvent, false, eventData); }
protected void OnValueChanged(Vector2 value) { if (debug) Debug.Log("OnValueChanged(vector2): "+value); if (action== ActionType.SendFsmEvent) { FsmEventData _eventData = new FsmEventData(); _eventData.Vector2Data = value; FirePlayMakerEvent(_eventData); }else { SetFsmVariable(value); } }
public static void SendEventToGameObject(PlayMakerFSM fromFsm,GameObject target,string fsmEvent,FsmEventData eventData) { SendEventToGameObject(fromFsm,target,fsmEvent,false,eventData); }
public static void SendEventToGameObject(PlayMakerFSM fromFsm, GameObject target, string fsmEvent, bool includeChildren, FsmEventData eventData) { if (fromFsm == null) { if (FsmEventSender == null) { FsmEventSender = new GameObject("PlayMaker Send Event Proxy").AddComponent <PlayMakerFSM>(); //FsmEventSender.hideFlags = HideFlags.HideAndDontSave; // not too sure if I should hide it or not.. cause we can't define the event sender yet FsmEventSender.FsmName = "Send Event Proxy"; FsmEventSender.FsmDescription = "This Fsm was created at runtime, because a script or component is willing to send a PlayMaker event"; } fromFsm = FsmEventSender; } if (eventData != null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } if (fromFsm == null) { return; } FsmEventTarget _eventTarget = new FsmEventTarget(); _eventTarget.excludeSelf = false; _eventTarget.sendToChildren = includeChildren; _eventTarget.target = FsmEventTarget.EventTarget.GameObject; FsmOwnerDefault owner = new FsmOwnerDefault(); owner.OwnerOption = OwnerDefaultOption.SpecifyGameObject; owner.GameObject = new FsmGameObject(); owner.GameObject.Value = target; _eventTarget.gameObject = owner; fromFsm.Fsm.Event(_eventTarget, fsmEvent); }
void FirePlayMakerEvent(FsmEventData eventData) { if (eventData!=null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } fsmEventTarget.excludeSelf = false; // _eventTarget.sendToChildren = false; if (PlayMakerUGuiSceneProxy.fsm == null) { Debug.LogError("Missing 'PlayMaker UGui' prefab in scene"); return; } Fsm _fsm = PlayMakerUGuiSceneProxy.fsm.Fsm; if (debug) Debug.Log("Fire event: "+GetEventString()); _fsm.Event(fsmEventTarget,GetEventString()); }
void onCGRefresh(CurvyCGEventArgs e) { FsmEventData _eventData = new FsmEventData(); this.FirePlayMakerEvent(CGOnRefresh, cgOnRefreshEventTarget, _eventData); }
protected void onEndEdit(string value) { if (debug) Debug.Log("onEndEdit(string): "+value); if (action== ActionType.SendFsmEvent) { FsmEventData _eventData = new FsmEventData(); _eventData.StringData = value; FirePlayMakerEvent(_eventData); }else { SetFsmVariable(value); } }
void onSplineRefresh(CurvySplineEventArgs e) { FsmEventData _eventData = new FsmEventData(); this.FirePlayMakerEvent(SplineOnRefresh, splineOnRefreshEventTarget, _eventData); }
protected void OnClick() { if (debug) Debug.Log("OnClick"); FsmEventData _eventData = new FsmEventData(); this.FirePlayMakerEvent(_eventData); }
void FirePlayMakerEvent(FsmEventSetup fsmEventSetup, FsmEventTarget fsmEventTarget, FsmEventData eventData) { if (eventData != null) { HutongGames.PlayMaker.Fsm.EventData = eventData; } fsmEventTarget.excludeSelf = false; if (PlayMakerCurvySceneProxy.fsm == null) { Debug.LogError("Missing 'PlayMaker Curvy' prefab in scene"); return; } Fsm _fsm = PlayMakerCurvySceneProxy.fsm.Fsm; if (fsmEventSetup.debug) { Debug.Log("Fire event: " + fsmEventSetup.EventString); } _fsm.Event(fsmEventTarget, fsmEventSetup.EventString); }