// Use this for initialization
    void Start()
    {
        //Initialize Server
        UNServer.Start(4, 25565, UNNetwork.GetLocalIPAddress());

        //Set ip label
        label.text += UNServer.ip_address;
    }
Esempio n. 2
0
 public void OnConnectButton()
 {
     if (m_field.text.Length == 0)
     {
         m_field.text = UNNetwork.GetLocalIPAddress();
     }
     if (!UNClient.connected)
     {
         PlayerPrefs.SetString("lastIP", m_field.text);
         UNClient.Connect(m_field.text);
     }
 }
Esempio n. 3
0
        public IEnumerator InitiateStartSequence(int countdown, int playerCount, float duration)
        {
            UNServer.Start(4, 25565, UNNetwork.GetLocalIPAddress());
            _mainMessage.gameObject.SetActive(true);
            _serverIP.text = UNServer.ip_address;


            _scoreP1.gameObject.SetActive(false);
            _scoreP2.gameObject.SetActive(false);
            _timeLeft.gameObject.SetActive(false);

            for (int i = countdown; i >= 0; i--)
            {
                _mainMessage.text = (i > 0) ? i.ToString() + "!" : "Start!";
                yield return(new WaitForSeconds(1f));
            }
            _mainMessage.gameObject.SetActive(false);
            _scoreP1.gameObject.SetActive(true);
            _scoreP2.gameObject.SetActive(true);
            _timeLeft.gameObject.SetActive(true);
            StartGame(playerCount, duration);
        }