/** * @module net/packets/outgoing */ import { Writer } from '../../writer'; import { Reader } from '../../reader'; import { PacketType } from '../../packet-type'; import { Packet } from '../../packet'; /** * Sent when an enemy has been hit by the player. */ export class EnemyHitPacket implements Packet { type = PacketType.ENEMYHIT; propagate = true; //#region packet-specific members /** * The current client time. */ time: number; /** * The id of the bullet which hit the enemy. */ bulletId: number; /** * The object id of the enemy which was hit. */ targetId: number; /** * Whether or not the projectile will kill the enemy. */ kill: boolean; //#endregion write(writer: Writer): void { writer.writeInt32(this.time); writer.writeByte(this.bulletId); writer.writeInt32(this.targetId); writer.writeBoolean(this.kill); } read(reader: Reader): void { this.time = reader.readInt32(); this.bulletId = reader.readByte(); this.targetId = reader.readInt32(); this.kill = reader.readBoolean(); } }