/** * @module net/data */ import { Writer } from '../writer'; import { Reader } from '../reader'; import { DataPacket } from '../packet'; import { Point } from '@n2/common'; export class WorldPosData extends Point implements DataPacket { read(reader: Reader): void { this.x = reader.readFloat(); this.y = reader.readFloat(); } write(writer: Writer): void { writer.writeFloat(this.x); writer.writeFloat(this.y); } /** * Returns a new `WorldPosData` object with the same X/Y coordinates. */ clone(): WorldPosData { const clone = new WorldPosData(); clone.x = this.x; clone.y = this.y; return clone; } }