Example #1
0
    void Start()
    {
        socket = GetComponent <SocketIOComponent> ();

        //Get stuff from the global control:
        // - the ip they put in, as well as the username
        GC = GameObject.Find("GlobalControl").GetComponent <GlobalControl>();
        //socket.url = GC.GetIpAddress ();
        username = GC.GetUsername();

        players   = new Dictionary <string, GameObject> ();
        gameState = new Dictionary <string, string> ();

        //Event handler registration
        socket.On("open", OnConnected);
        socket.On("spawn", OnSpawn);
        socket.On("disconnected", OnDisconnected);
        socket.On("tick", OnTick);
        socket.On("leaderboard", OnLeaderboard);
    }