示例#1
0
    private void OnUpdateScore(SocketIOEvent obj)
    {
        // Debug.Log("Update scores: " + obj.data);

        var player = spawner.findPlayer(obj.data["id"].ToString());
        var score  = MakeScoreFromJson(obj);

        // Debug.Log(score);
        player.GetComponent <Points>().points = score;
    }
示例#2
0
    private void OnUpdatePosition(SocketIOEvent obj)
    {
        Debug.Log("Updating positions " + obj.data);

        //var v = float.Parse(obj.data["v"].ToString().Replace("\"", ""));
        //var h = float.Parse(obj.data["h"].ToString().Replace("\"", ""));
        var position = MakePosFromJson(obj);
        var player   = spawner.findPlayer(obj.data["id"].ToString());
        var rotation = obj.data["rotz"].n;

        player.transform.position    = position;
        player.transform.eulerAngles = new Vector3(0, 0, rotation);
    }