public bool SendEvent(PlayMakerFSM fromFsm, PlayMakerEventTarget eventTarget) { if (fromFsm == null) { if (PlayMakerUtils.FsmEventSender == null) { PlayMakerUtils.FsmEventSender = new GameObject("PlayMaker Send Event Proxy").AddComponent <PlayMakerFSM>(); PlayMakerUtils.FsmEventSender.FsmName = "Send Event Proxy"; PlayMakerUtils.FsmEventSender.FsmDescription = "This Fsm was created at runtime, because a script or component is willing to send a PlayMaker event"; } fromFsm = PlayMakerUtils.FsmEventSender; } // Debug.Log("Sending event <"+eventName+"> from fsm:"+fromFsm.FsmName+" "+eventTarget.eventTarget+" "+eventTarget.gameObject+" "+eventTarget.fsmComponent); if (eventTarget.eventTarget == ProxyEventTarget.BroadCastAll) { PlayMakerFSM.BroadcastEvent(eventName); } else if (eventTarget.eventTarget == ProxyEventTarget.Owner || eventTarget.eventTarget == ProxyEventTarget.GameObject) { PlayMakerUtils.SendEventToGameObject(fromFsm, eventTarget.gameObject, eventName, eventTarget.includeChildren); } else if (eventTarget.eventTarget == ProxyEventTarget.FsmComponent) { eventTarget.fsmComponent.SendEvent(eventName); } return(true); }
public void Cmd_SendEvent(string eventName) { if (debug) { Debug.Log(this.name + ": Cmd_SendEvent-> " + eventName, this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, eventName); }
public void Rpc_SendEvent_WithStringData(string eventName, string data) { if (debug) { Debug.Log(this.name + ": Rpc_SendEvent-> " + eventName + " : data:" + data, this); } Fsm.EventData.StringData = data; PlayMakerUtils.SendEventToGameObject(null, this.gameObject, eventName); }
public override void OnNetworkDestroy() { base.OnNetworkDestroy(); if (debug) { Debug.Log(this.name + ": OnNetworkDestroy ", this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, "UNET / ON NETWORK DESTROY"); }
public override void OnStartLocalPlayer() { base.OnStartLocalPlayer(); if (debug) { Debug.Log(this.name + ": OnStartClient isLocalPlayer:" + isLocalPlayer, this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, "UNET / ON START LOCAL PLAYER"); }
public override void OnStartClient() { base.OnStartClient(); if (debug) { Debug.Log(this.name + ": OnStartClient", this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, "UNET / ON START CLIENT"); }
public override void OnStartAuthority() { base.OnStartAuthority(); if (debug) { Debug.Log(this.name + ": OnStartAuthority", this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, "UNET / ON START AUTHORITY"); }
void rpc(string globalEventName, PhotonMessageInfo info) // method name used to be too long : RPC_PhotonRpcBroadcastFsmEvent { if (LogMessageInfo) { Debug.Log("RPC Received for owner+" + this.photonView.OwnerActorNr + " for global event '" + globalEventName + "' info:" + info, this); } // lastMessagePhotonPlayer = info.Sender; PlayMakerUtils.SendEventToGameObject(null, this.gameObject, globalEventName, true); }
public override void OnStartServer() { base.OnStartServer(); if (debug) { Debug.Log(this.name + ": OnStartServer ", this); } PlayMakerUtils.SendEventToGameObject(null, this.gameObject, "UNET / ON START SERVER"); }
public bool SendEvent(PlayMakerFSM fromFsm, PlayMakerEventTarget eventTarget) { //Debug.Log("Sending event <"+eventName+"> from fsm:"+fromFsm.FsmName+" "+eventTarget.eventTarget+" "+eventTarget.gameObject+" "+eventTarget.fsmComponent); if (eventTarget.eventTarget == ProxyEventTarget.BroadCastAll) { fromFsm.SendEvent(eventName); } else if (eventTarget.eventTarget == ProxyEventTarget.Owner || eventTarget.eventTarget == ProxyEventTarget.GameObject) { PlayMakerUtils.SendEventToGameObject(fromFsm, eventTarget.gameObject, eventName, eventTarget.includeChildren); } else if (eventTarget.eventTarget == ProxyEventTarget.FsmComponent) { eventTarget.fsmComponent.SendEvent(eventName); } return(true); }
//Define the event handler. void NodeTouchedHandler(object src, XmlNodeChangedEventArgs args) { //Debug.Log("Node " + args.Node.Name + " action:"+args.Action); if (FsmEventTarget == null || !delegationActive) { return; } if (args.Action == XmlNodeChangedAction.Insert) { PlayMakerUtils.SendEventToGameObject(FsmEventTarget, FsmEventTarget.gameObject, "XML / INSERTED"); } else if (args.Action == XmlNodeChangedAction.Change) { PlayMakerUtils.SendEventToGameObject(FsmEventTarget, FsmEventTarget.gameObject, "XML / CHANGED"); } else if (args.Action == XmlNodeChangedAction.Remove) { PlayMakerUtils.SendEventToGameObject(FsmEventTarget, FsmEventTarget.gameObject, "XML / REMOVED"); } }
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++; * } * */ }
public bool SendEvent(PlayMakerFSM fromFsm, PlayMakerTimelineEventTarget eventTarget, bool debug = false) { fromFsm = SanitizeFsmEventSender(fromFsm); if (debug) { Debug.Log("Sending event <" + eventName + "> from fsm:" + fromFsm.FsmName + " " + eventTarget.eventTarget + " " + eventTarget.gameObject + " " + eventTarget.fsmComponent); } if (eventTarget.eventTarget == ProxyEventTarget.BroadCastAll) { PlayMakerFSM.BroadcastEvent(eventName); } else if (eventTarget.eventTarget == ProxyEventTarget.Owner || eventTarget.eventTarget == ProxyEventTarget.GameObject) { PlayMakerUtils.SendEventToGameObject(fromFsm, eventTarget.gameObject, eventName, eventTarget.includeChildren); } else if (eventTarget.eventTarget == ProxyEventTarget.FsmComponent) { eventTarget.fsmComponent.SendEvent(eventName); } return(true); }
public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { if (debug) { Debug.Log("PlayMakerSanPlayerLobbyHook OnLobbyServerSceneLoadedForPlayer lobbyPlayer:" + lobbyPlayer + " gamePlayer:" + gamePlayer, this); } if (lobbyPlayer == null) { return; } LobbyPlayer lp = lobbyPlayer.GetComponent <LobbyPlayer>(); if (lp != null) { Debug.Log("Local Player name :" + lp.playerName + " Color:" + lp.playerColor); Fsm.EventData.StringData = lp.playerName; Fsm.EventData.ColorData = lp.playerColor; PlayMakerUtils.SendEventToGameObject(null, gamePlayer, "UNET / SAN / ON LOBBY SERVER SCENE LOADED FOR PLAYER"); } }
public void SendPlayMakerEvent() { PlayMakerUtils.SendEventToGameObject(this.GetComponent <PlayMakerFSM>(), this.gameObject, "ANIMATION EVENT"); }
public static void SendEventToGameObject(PlayMakerFSM fromFsm, GameObject target, string fsmEvent) { PlayMakerUtils.SendEventToGameObject(fromFsm, target, fsmEvent, null); }