// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class Science implements flatbuffers.IUnpackableObject<ScienceT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):Science {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsScience(bb:flatbuffers.ByteBuffer, obj?:Science):Science {
  return (obj || new Science()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsScience(bb:flatbuffers.ByteBuffer, obj?:Science):Science {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new Science()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

drive():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

weapons():number {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

shields():number {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

cargo():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

static startScience(builder:flatbuffers.Builder) {
  builder.startObject(5);
}

static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, nameOffset, 0);
}

static addDrive(builder:flatbuffers.Builder, drive:number) {
  builder.addFieldFloat32(1, drive, 0.0);
}

static addWeapons(builder:flatbuffers.Builder, weapons:number) {
  builder.addFieldFloat32(2, weapons, 0.0);
}

static addShields(builder:flatbuffers.Builder, shields:number) {
  builder.addFieldFloat32(3, shields, 0.0);
}

static addCargo(builder:flatbuffers.Builder, cargo:number) {
  builder.addFieldFloat32(4, cargo, 0.0);
}

static endScience(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createScience(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, drive:number, weapons:number, shields:number, cargo:number):flatbuffers.Offset {
  Science.startScience(builder);
  Science.addName(builder, nameOffset);
  Science.addDrive(builder, drive);
  Science.addWeapons(builder, weapons);
  Science.addShields(builder, shields);
  Science.addCargo(builder, cargo);
  return Science.endScience(builder);
}

unpack(): ScienceT {
  return new ScienceT(
    this.name(),
    this.drive(),
    this.weapons(),
    this.shields(),
    this.cargo()
  );
}


unpackTo(_o: ScienceT): void {
  _o.name = this.name();
  _o.drive = this.drive();
  _o.weapons = this.weapons();
  _o.shields = this.shields();
  _o.cargo = this.cargo();
}
}

export class ScienceT implements flatbuffers.IGeneratedObject {
constructor(
  public name: string|Uint8Array|null = null,
  public drive: number = 0.0,
  public weapons: number = 0.0,
  public shields: number = 0.0,
  public cargo: number = 0.0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const name = (this.name !== null ? builder.createString(this.name!) : 0);

  return Science.createScience(builder,
    name,
    this.drive,
    this.weapons,
    this.shields,
    this.cargo
  );
}
}
