@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
19 lines (15 loc) • 738 B
JavaScript
import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
import { BinaryClassUpgrader } from "../../../ecs/storage/binary/BinaryClassUpgrader.js";
export class PathFollowerSerializationUpgrader_3_4 extends BinaryClassUpgrader {
__startVersion = 3;
__targetVersion = 4;
upgrade(source, target) {
// Copy existing fields
BinaryBuffer.copyUint16(source, target); // flags
BinaryBuffer.copyFloat32(source, target); // speed
BinaryBuffer.copyFloat32(source, target); // rotationSpeed
BinaryBuffer.copyFloat32(source, target); // maxMoveDistance
// Add the new field with a default value
target.writeFloat32(0); // Default position
}
}