コード例 #1
0
        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);
        }
コード例 #2
0
		public bool SendEvent(PlayMakerFSM fromFsm,PlayMakerEventTarget eventTarget)
		{
			if (fromFsm==null)
			{
				if (FsmEventSender==null)
				{
					FsmEventSender = new GameObject("PlayMaker Send Event Proxy").AddComponent<PlayMakerFSM>();
					FsmEventSender.FsmName = "Send Event Proxy";
					FsmEventSender.FsmDescription = "This Fsm was created at runtime, because a script is willing to send a PlayMaker event but has not specified the Fsm Sender";
				}
				fromFsm = 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;
		}
コード例 #3
0
        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)
            {
                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;
        }
コード例 #4
0
        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);
        }