예제 #1
0
    void Start()
    {
        if (PhotonNetwork.connected)
        {
            return;
        }

        if (QuantumRunner.Current)
        {
            return;
        }

        Debug.Log("### Starting quantum in local debug mode ###");

        var mapdata = FindObjectOfType <MapData>();

        if (mapdata)
        {
            // set singleplayer
            Config.GameMode = Photon.Deterministic.DeterministicGameMode.Local;

            // set map to this maps asset
            Config.Map.Guid = mapdata.Asset.AssetObject.Guid;

            // start with debug config
            QuantumRunner.StartGame(Config);
        }
        else
        {
            throw new Exception("No MapData object found, can't debug start scene");
        }
    }
예제 #2
0
        void CheckForGameStart()
        {
            if (_started)
            {
                return;
            }

            var start = false;
            var map   = default(String);

            if (TryGetRoomProperty <Boolean>("START", out start) && TryGetRoomProperty <String>("MAP", out map))
            {
                if (start && String.IsNullOrEmpty(map) == false)
                {
                    _started = true;

                    RuntimeConfig config;
                    config         = new RuntimeConfig();
                    config.Players = new RuntimePlayer[PhotonNetwork.room.MaxPlayers];

                    for (Int32 i = 0; i < config.Players.Length; ++i)
                    {
                        config.Players[i] = new RuntimePlayer();
                        config.Players[i].CharacterSpec.Guid = "mage";
                    }

                    config.Map.Guid = UnityDB.AllOf <MapAsset>().First(x => x.Settings.Scene == map).Settings.Guid;
                    config.GameMode = Photon.Deterministic.DeterministicGameMode.Multiplayer;

                    QuantumRunner.StartGame(config);

                    UIRoom.HideScreen();
                    UILeaveGame.ShowScreen();
                }
            }
        }