void DoREC()
        {
            // get the photon proxy for Photon RPC access
            GameObject go = GameObject.Find("PlayMaker Photon Proxy");

            if (go == null)
            {
                return;
            }


            if (remoteEvent != null && remoteEvent.IsGlobal == false)
            {
                return;
            }

            PhotonTargets _photonTargets = getPhotonTargets();

            // get the proxy component
            PlayMakerPhotonProxy _proxy = go.GetComponent <PlayMakerPhotonProxy>();

            if (_proxy == null)
            {
                Debug.LogWarning("PlayMakerPhotonProxy is missing");
                return;
            }

            if (eventTarget.target == FsmEventTarget.EventTarget.BroadcastAll)
            {
                if (!stringData.IsNone && stringData.Value != "")
                {
                    _proxy.PhotonRpcBroacastFsmEventWithString(_photonTargets, remoteEvent.Name, stringData.Value);
                }
                else
                {
                    _proxy.PhotonRpcBroacastFsmEvent(photonTargets, remoteEvent.Name);
                }
            }
            else
            {
                PlayMakerPhotonGameObjectProxy _goProxy = Owner.GetComponent <PlayMakerPhotonGameObjectProxy>();
                if (_proxy == null)
                {
                    Debug.LogWarning("PlayMakerPhotonProxy is missing");
                    return;
                }

                if (!stringData.IsNone && stringData.Value != "")
                {
                    _goProxy.PhotonRpcSendFsmEventWithString(_photonTargets, remoteEvent.Name, stringData.Value);
                }
                else
                {
                    _goProxy.PhotonRpcSendFsmEvent(photonTargets, remoteEvent.Name);
                }
            }
        }
        void DoRPC()
        {
            // get the photon proxy for Photon RPC access
            GameObject go = GameObject.Find("PlayMaker Photon Proxy");

            if (go == null)
            {
                return;
            }


            if (remoteEvent != null && remoteEvent.IsGlobal == false)
            {
                return;
            }

            RpcTarget _photonTargets = getPhotonTargets();

            // get the proxy component
            PlayMakerPhotonProxy _proxy = go.GetComponent <PlayMakerPhotonProxy>();

            if (_proxy == null)
            {
                Debug.LogWarning("PlayMakerPhotonProxy is missing");
                return;
            }

            if (eventTarget.target == FsmEventTarget.EventTarget.BroadcastAll)
            {
                if (data.Length > 0)
                {
                    //_proxy.PhotonRpcFsmBroadcastEventWithData(_photonTargets,remoteEvent.Name,data);
                }
                else
                {
                    _proxy.PhotonRpcBroacastFsmEvent(rpcTarget, remoteEvent.Name);
                }
            }
            else
            {
                PlayMakerPhotonGameObjectProxy _goProxy = Owner.GetComponent <PlayMakerPhotonGameObjectProxy>();
                if (_proxy == null)
                {
                    Debug.LogWarning("PlayMakerPhotonProxy is missing");
                    return;
                }

                if (data.Length > 0)
                {
                    _goProxy.PhotonRpcSendFsmEventWithData(_photonTargets, remoteEvent.Name, data);
                }
                else
                {
                    _goProxy.PhotonRpcSendFsmEvent(rpcTarget, remoteEvent.Name);
                }
            }
        }
Exemple #3
0
    public override void  OnInspectorGUI()
    {
        PlayMakerPhotonGameObjectProxy _target = target as PlayMakerPhotonGameObjectProxy;

        if (GUILayout.Button("Help"))
        {
            _target.help();
        }
    }
    /// <summary>
    /// Used to check for fsm that required a photon view, and make sure it is set up properly: fsm<->playmakerPhotonView<->PhotonView
    /// </summary>
    void Start()
    {
        ArrayList FsmToObserveList = GetFsmsWithNetworkSynchedVariables();

        //now for each of these Fsm check that a playmaker Photon gameObject proxy is attached to it, else will complain
        foreach (PlayMakerFSM fsm in FsmToObserveList)
        {
            PlayMakerPhotonGameObjectProxy goProxy = fsm.gameObject.GetComponent <PlayMakerPhotonGameObjectProxy>();

            if (goProxy == null)
            {
                Debug.LogError("Missing PlayMakerPhotonGameObjectProxy on GameObject '" + fsm.gameObject.name + "' with Fsm '" + fsm.FsmName + "' containing variables supposed to be synched over the network");
            }
        }
    }    // start
        void ExecuteAction()
        {
            if (remoteEvent.Name == "")
            {
                return;
            }

            if (PlayMakerPhotonProxy.Instance == null)
            {
                Debug.LogError("PlayMakerPhotonProxy is missing in the scene");
                return;
            }


            _player = player.GetPlayer(this);

            if (_player == null)
            {
                return;
            }

            foreach (PhotonView photonView in PhotonNetwork.PhotonViewCollection)
            {
                if (photonView.Owner == _player)
                {
                    PlayMakerPhotonGameObjectProxy _playerGameObjectProxy =
                        photonView.gameObject.GetComponent <PlayMakerPhotonGameObjectProxy>();

                    if (_playerGameObjectProxy != null)
                    {
                        if (!stringData.IsNone && stringData.Value != "")
                        {
                            _playerGameObjectProxy.PhotonRpcFsmBroadcastEventWithString(_player, remoteEvent.Name, stringData.Value);
                        }
                        else
                        {
                            _playerGameObjectProxy.PhotonRpcBroadcastFsmEvent(_player, remoteEvent.Name);
                        }
                    }
                }
            }
        }