Ejemplo n.º 1
0
    public static byte[] Serialize(object obj)
    {
        var vec     = obj as Vec2;
        var playObj = new PlayObject {
            { "x", vec.X },
            { "y", vec.Y }
        };

        return(CodecUtils.SerializePlayObject(playObj));
    }
Ejemplo n.º 2
0
    public static byte[] Serialize(object obj)
    {
        var move    = obj as Move;
        var playObj = new PlayObject {
            { "p", move.Pos },
            { "d", move.Dir },
            { "t", move.Time }
        };

        return(CodecUtils.SerializePlayObject(playObj));
    }
Ejemplo n.º 3
0
    public static byte[] Serialize(object obj)
    {
        Food food    = obj as Food;
        var  playObj = new PlayObject {
            { "id", food.Id },
            { "type", food.Type },
            { "x", food.X },
            { "y", food.Y }
        };

        return(CodecUtils.SerializePlayObject(playObj));
    }