Пример #1
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Пример #2
0
 private void Start()
 {
     GameflowManager.GFM.OnGameEnded += OnEndGameHandler;
     EndGameMsg.SetActive(false);
     startNewGameKey.SetActive(false);
     PL = FindObjectOfType <PhotonLobby>();
 }
Пример #3
0
 private void Awake()
 {
     if (PhotonLobby.INSTANCE == null)
     {
         PhotonLobby.INSTANCE = this;
     }
 }
Пример #4
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Пример #5
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #6
0
 private void Awake()
 {
     if (instance)
     {
         Destroy(this);
         return;
     }
     instance = this;
 }
Пример #7
0
    public void CreateServer()
    {
        PhotonLobby lobby = ServiceLocator.GetServiceOfType <PhotonLobby>();

        if (lobby.HostRoom(servernameInputfield.text, newServerPassworldInputfield.text))
        {
            CloseSubWindow(serverCreationWindow);
        }
    }
Пример #8
0
 private void Awake()
 {
     if (photonLobby == null)
     {
         photonLobby = this;
     }
     else if (photonLobby != this)
     {
         Destroy(gameObject);
     }
     Instantiate(room);
 }
Пример #9
0
    public void TryToJoinRoom()
    {
        PhotonLobby pl = ServiceLocator.GetServiceOfType <PhotonLobby>();

        if (pl.PasswordMatches(chosenRoom, passwordInputfield.text))
        {
            pl.JoinRoom(chosenRoom);
        }
        else
        {
            ServiceLocator.GetServiceOfType <UIManager>().ShowMessage("The password does not match");
        }
    }
Пример #10
0
    public void Awake()
    {
        DontDestroyOnLoad(gameObject);

        if (PhotonLobby.photonLobby == null)
        {
            PhotonLobby.photonLobby = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
Пример #11
0
    private void CheckForPassword(string serverName)
    {
        chosenRoom = serverName;
        PhotonLobby pl = ServiceLocator.GetServiceOfType <PhotonLobby>();

        if (pl.ServerHasPassword(chosenRoom))
        {
            print("Server has password");
            OpenSubWindow(serverPasswordWindow);
        }
        else
        {
            pl.JoinRoom(chosenRoom);
        }
    }
Пример #12
0
 private void Awake()
 {
     lobby = this; // create singleton, lives within the main menu scene
     // if(PhotonLobby.lobby == null)
     // {
     //     PhotonLobby.lobby = this;
     // } else
     // {
     //     if(PhotonLobby.lobby != this)
     //     {
     //         Destroy(PhotonLobby.lobby.gameObject);
     //         PhotonLobby.lobby = this;
     //     }
     // }
 }
Пример #13
0
    private void Awake()
    {
        //lobby = this; //creates/initializes the singleton, lives within the Main menu scene

        if (lobby && lobby != this)
        {
            Destroy(gameObject);
        }
        else
        {
            lobby = this;
        }


        //PhotonNetwork.AutomaticallySyncScene = true;  //this enables use of PhotonNetwork.LoadLevel() on master client and all clients in the same room sync their level automatically
        DontDestroyOnLoad(lobby);
    }
Пример #14
0
    //Connect to master photon server.
    void Start()
    {
        if (PhotonLobby.lobby == null)
        {
            PhotonLobby.lobby = this;
        }
        else
        {
            if (PhotonLobby.lobby != this)
            {
                Destroy(PhotonLobby.lobby.gameObject);
                PhotonLobby.lobby = this;
            }
        }

        PhotonNetwork.ConnectUsingSettings();
        roomListings = new List <RoomInfo>();
    }
Пример #15
0
    void Awake()
    {
        if (PhotonLobby.Lobby == null)
        {
            PhotonLobby.Lobby = this;
        }
        else
        {
            if (PhotonLobby.Lobby != this)
            {
                Destroy(PhotonLobby.Lobby.gameObject);
                PhotonLobby.Lobby = this;
            }
        }
        DontDestroyOnLoad(this.gameObject);

        GenericNetworkManager.OnReadyToStartNetwork += StartNetwork;
    }
Пример #16
0
    private void Start()
    {
        _print(true, "Start begin");
        roomOptions = new RoomOptions {
            IsVisible = true, IsOpen = true, MaxPlayers = maxPlayersPerRoom
        };
        if (Lobby == null)
        {
            _print(true, "Start: Lobby == null");
            Lobby = this;
        }

        if (Lobby != this)
        {
            _print(true, "Start: Lobby != this");
            Destroy(Lobby.gameObject);
            Lobby = this;
        }

        DontDestroyOnLoad(gameObject);
        _print(true, "ConnectUsingSettings begin");
        PhotonNetwork.ConnectUsingSettings();
        _print(true, "Start finish");
    }
Пример #17
0
    void Update()
    {
        _sharks = GameObject.FindGameObjectsWithTag("Shark");
        sharks  = _sharks.Length;
        //Debug.Log(_sharks.Length);
        if (sharks > 2)
        {
            Destroy(_sharks[1]);
        }
        ;

        swimmers = _swimmers.Count;
        List <GameObject> itemsToRemove = new List <GameObject>();

        foreach (var swim in _swimmers)
        {
            if (swim == null)
            {
                itemsToRemove.Add(swim);
            }
        }

        foreach (var dead in itemsToRemove)
        {
            _swimmers.Remove(dead);
            CreateAgent(this.agentPrefab);
        }

        lobby = GameObject.FindGameObjectWithTag("lobby").GetComponent <PhotonLobby>();

        if (Input.GetKeyDown(KeyCode.Space))
        {
            //SceneManager.LoadScene(0);
            lobby.OnCancelButtonClicked();
        }
    }
Пример #18
0
 public GameObject cancelButton; // Cancel the searching
 private void Awake()
 {
     lobby = this;    //Creating a lobby using Singleton design pattern.
 }
Пример #19
0
 private void Awake()
 {
     lobby = this; //creates the singleton, lives within the Main Menu scene
 }
Пример #20
0
 void Awake()
 {
     lobby = this;
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
 }
Пример #21
0
 private void Awake()
 {
     lobby = this;
 }
Пример #22
0
 private void Awake()
 {
     lobby = this; //Create the singleton, lives the Main menu scene;
 }
Пример #23
0
 private void Awake()
 {
     Lobby = this;//Creates the singleton, lives within the Main menu screne
 }
Пример #24
0
 private void Awake()
 {
     lobby = this; // Singleton
 }
Пример #25
0
 private void Awake()
 {
     lobby = this; // For the singleton, lives within the main menu screen.
 }
Пример #26
0
 private void Awake()
 {
     lobby = this; //Singleton in main menu scene
 }
 private void Awake()
 {
     lobby = this; //creates singleton,lives within main menu scene.
 }
Пример #28
0
 void Awake()
 {
     lobby = this;
 }
Пример #29
0
 public void StartNetwork()
 {
     PhotonNetwork.ConnectUsingSettings();
     Lobby = this;
 }
Пример #30
0
 private void Awake()
 {
     lobby = this; //Creates singleton lobby
 }