public override void Deserialize(NetworkReader reader)
    {
        Vector2?position       = null;
        var     hasNewPosition = reader.ReadBoolean();

        if (hasNewPosition)
        {
            position = reader.ReadVector2();
        }
        Direction?orientation       = null;
        var       hasNewOrientation = reader.ReadBoolean();

        if (hasNewOrientation)
        {
            orientation = DirectionIO.readDirectionFromBuffer(reader);
        }
        var bullets   = new HashSet <BulletState>();
        var numBullet = reader.ReadInt32();

        for (var i = 0; i < numBullet; i++)
        {
            var bullet = new BulletState();
            bullet.Deserialize(reader);
            bullets.Add(bullet);
        }
        NewPosition    = position;
        NewOrientation = orientation;
        BulletsCreated = bullets;
    }
    public override void Deserialize(NetworkReader reader)
    {
        var locals   = new Dictionary <int, LocalState>();
        var numLocal = reader.ReadInt32();

        for (var i = 0; i < numLocal; i++)
        {
            var id    = reader.ReadInt32();
            var state = new LocalState();
            state.Deserialize(reader);
            locals[id] = state;
        }

        var bullets   = new Dictionary <string, BulletState>();
        var numBullet = reader.ReadInt32();

        for (var i = 0; i < numBullet; i++)
        {
            var id    = reader.ReadString();
            var state = new BulletState();
            state.Deserialize(reader);
            bullets[id] = state;
        }

        LocalStates  = locals;
        BulletStates = bullets;
    }