import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
import { FailingBehavior } from "./FailingBehavior.js";

export class FailingBehaviorSerializationAdapter extends BinaryClassSerializationAdapter {
    klass = FailingBehavior;
    version = 0;

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {FailingBehavior} value
     */
    serialize(buffer, value) {
        buffer.writeUintVar(value.delayTicks);
    }

    /**
     *
     * @param {BinaryBuffer} buffer
     * @param {FailingBehavior} value
     */
    deserialize(buffer, value) {
        value.delayTicks = buffer.readUintVar();
    }
}
