コード例 #1
0
    // Use this for initialization
    void Start()
    {
        //Initialize Server
        UNServer.Start(4, 25565, UNNetwork.GetLocalIPAddress());

        //Set ip label
        label.text += UNServer.ip_address;
    }
コード例 #2
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);
        }