// EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (PhotonNetwork.InRoom)
            {
                Room room = PhotonNetwork.CurrentRoom;

                if (permission == Permission.MasterClient && !PhotonNetwork.IsMasterClient)
                {
                    return(true);
                }

                switch (variableType)
                {
                case VariableType.Int:
                    if (operation == Operation.Set)
                    {
                        room.SetInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                    }
                    else
                    {
                        room.AddInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                    }
                    break;

                case VariableType.Float:
                    if (operation == Operation.Set)
                    {
                        room.SetFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                    }
                    else
                    {
                        room.AddFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                    }
                    break;

                case VariableType.String:
                    room.SetString(propertyName.GetValue(target), stringValue.GetValue(target), webForward);
                    break;

                case VariableType.Bool:
                    room.SetBool(propertyName.GetValue(target), boolValue.GetValue(target), webForward);
                    break;
                }
            }
            else
            {
                Debug.LogWarning("You need to be inside a room in order to change a Room property.", gameObject);
            }
            return(true);
        }
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            RoomOptions roomOptions = new RoomOptions()
            {
            };

            roomOptions.MaxPlayers    = (byte)maxPlayers.GetValue(target);
            roomOptions.PublishUserId = true;
            return(PhotonNetwork.JoinOrCreateRoom(string.IsNullOrEmpty(roomName.GetValue(target)) ? null : roomName.GetValue(target), roomOptions, TypedLobby.Default));
        }
Exemplo n.º 3
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override IEnumerator Execute(GameObject target, IAction[] actions, int index)
        {
            RoomOptions roomOptions = new RoomOptions()
            {
            };

            roomOptions.PublishUserId = true;
            roomOptions.MaxPlayers    = (byte)((float)maxPlayers.GetValue(target));
            roomOptions.PlayerTtl     = playerTTL.GetValue(target);
            PhotonNetwork.CreateRoom(string.IsNullOrEmpty(roomName.GetValue(target)) ? null : roomName.GetValue(target), roomOptions, TypedLobby.Default);
            yield return(0);
        }
Exemplo n.º 4
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (PhotonNetwork.InRoom)
            {
                Player player = this.target.GetPhotonPlayer(target);

                if (player == null)
                {
                    return(true);
                }
                if (permission == Permission.LocalPlayer && !player.IsLocal)
                {
                    return(true);
                }
                if (permission == Permission.MasterClient && !PhotonNetwork.IsMasterClient)
                {
                    return(true);
                }

                if (player != null)
                {
                    switch (variableType)
                    {
                    case VariableType.Int:
                        if (operation == Operation.Set)
                        {
                            player.SetInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                        }
                        else
                        {
                            player.AddInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                        }
                        break;

                    case VariableType.Float:
                        if (operation == Operation.Set)
                        {
                            player.SetFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                        }
                        else
                        {
                            player.AddFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                        }
                        break;

                    case VariableType.String:
                        player.SetString(propertyName.GetValue(target), stringValue.GetValue(target), webForward);
                        break;

                    case VariableType.Bool:
                        player.SetBool(propertyName.GetValue(target), boolValue.GetValue(target), webForward);
                        break;
                    }
                }
            }
            else
            {
                Debug.LogWarning("You need to be inside a room in order to change a PhotonPlayer property.", gameObject);
            }
            return(true);
        }
Exemplo n.º 5
0
 public bool equals(IntProperty other)
 {
     return(this.GetValue() == other.GetValue());
 }
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            GameObject instance = null;

            if (instantiate == InstantiateType.PlayerObject)
            {
                instance = PhotonNetwork.Instantiate(prefab.GetPrefabId(), initLocation.GetPosition(target), initLocation.GetRotation(target), (byte)group.GetValue(target));
            }
            else
            {
                instance = PhotonNetwork.InstantiateSceneObject(prefab.GetPrefabId(), initLocation.GetPosition(target), initLocation.GetRotation(target), (byte)group.GetValue(target), null);
            }
            this.assignToVariable.Set(instance, target);
            return(true);
        }