Esempio n. 1
0
        void SetPlayerProperty()
        {
            if (customPropertyValue == null)
            {
                LogError("customPropertyValue is null ");
                Fsm.Event(failureEvent);
                return;
            }

            _player = player.GetPlayer(this);

            if (_player != null)
            {
                if (!_player.Equals(PhotonNetwork.LocalPlayer) && !PhotonNetwork.IsMasterClient)
                {
                    LogError("setting a player custom property different from your LocalPlayer is not allowed, unless you are the current MasterClient");
                    Fsm.Event(failureEvent);
                }
                else
                {
                    ExitGames.Client.Photon.Hashtable _prop = new ExitGames.Client.Photon.Hashtable();
                    //Log(" set key "+customPropertyKey.Value+"="+ PlayMakerUtils.GetValueFromFsmVar(this.Fsm,customPropertyValue));

                    _prop[customPropertyKey.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertyValue);
                    _player.SetCustomProperties(_prop);
                    Fsm.Event(successEvent);
                }
            }
            else
            {
                LogError("Player reference is null");
                Fsm.Event(failureEvent);
            }
        }
Esempio n. 2
0
        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;
            }

            if (!stringData.IsNone && stringData.Value != "")
            {
                PlayMakerPhotonProxy.Instance.PhotonRpcFsmBroadcastEventWithString(_player, remoteEvent.Name, stringData.Value);
            }
            else
            {
                PlayMakerPhotonProxy.Instance.PhotonRpcBroadcastFsmEvent(_player, remoteEvent.Name);
            }
        }
        void ExecuteAction()
        {
            _player = player.GetPlayer(this);
            _result = false;

            if (_player == null)
            {
                LogError("Player reference is null");
            }
            else
            {
                if (!PhotonNetwork.IsMasterClient)
                {
                    LogError("Operation can only be done on the current MasterClient");
                }
                else
                {
                    _result = PhotonNetwork.SetMasterClient(_player);
                }

                if (!_result)
                {
                    LogError("Operation Failed");
                }
            }

            if (!result.IsNone)
            {
                result.Value = _result;
            }

            Fsm.Event(_result ? successEvent : errorEvent);
        }
Esempio n. 4
0
        void ExecuteAction()
        {
            if (!PhotonNetwork.InRoom)
            {
                LogError("Operation only allowed when inside a room");
                Fsm.Event(failureEvent);
                return;
            }

            _player = player.GetPlayer(this);

            if (_player != null)
            {
                if (!_player.Equals(PhotonNetwork.LocalPlayer) && !PhotonNetwork.IsMasterClient)
                {
                    LogError("Removing a player's Buffered RPC different then your LocalPlayer is not allowed, unless you are the current MasterClient");
                    Fsm.Event(failureEvent);
                }
                else
                {
                    PhotonNetwork.RemoveRPCs(_player);
                    Fsm.Event(successEvent);
                }
            }
            else
            {
                LogError("Player reference is null");
                Fsm.Event(failureEvent);
            }
        }
Esempio n. 5
0
        public override void OnEnter()
        {
            bool _result = PhotonNetwork.CloseConnection(player.GetPlayer(this));

            if (!result.IsNone)
            {
                result.Value = _result;
            }

            Fsm.Event(_result ? willProceed : willNotProceed);
            Finish();
        }
        void ExecuteAction()
        {
            _player = player.GetPlayer(this);

            if (_player == null)
            {
                return;
            }

            if (!nickname.IsNone)
            {
                nickname.Value = _player.NickName;
            }
            if (!actorNumber.IsNone)
            {
                actorNumber.Value = _player.ActorNumber;
            }
            if (!userId.IsNone)
            {
                userId.Value = _player.UserId;
            }
            if (!isInactive.IsNone)
            {
                isInactive.Value = _player.IsInactive;
            }
            if (!isLocal.IsNone)
            {
                isLocal.Value = _player.IsLocal;
            }
            if (!isMasterClient.IsNone)
            {
                isMasterClient.Value = _player.IsMasterClient;
            }


            customPropertiesValues = new FsmString[customPropertyKeys.Length];


            // get the custom properties
            int i = 0;

            foreach (FsmString key in customPropertyKeys)
            {
                if (_player.CustomProperties.ContainsKey(key.Value) && !customPropertiesValues[i].IsNone)
                {
                    customPropertiesValues[i] = (string)_player.CustomProperties[key.Value];
                }
                i++;
            }
        }
        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);
                        }
                    }
                }
            }
        }
        void ExecuteAction()
        {
            _player = player.GetPlayer(this);

            if (_player != null)
            {
                if (!_player.Equals(PhotonNetwork.LocalPlayer) && !PhotonNetwork.IsMasterClient)
                {
                    LogError("Destroying a player different from your LocalPlayer is not allowed, unless you are the current MasterClient");
                    Fsm.Event(failureEvent);
                }
                else
                {
                    PhotonNetwork.DestroyPlayerObjects(_player);
                    Fsm.Event(successEvent);
                }
            }
            else
            {
                LogError("Player reference is null");
                Fsm.Event(failureEvent);
            }
        }