mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 01:24:41 +08:00
27 lines
758 B
JavaScript
27 lines
758 B
JavaScript
import Grammar from "../serialization/Grammar.js"
|
|
import IEntity from "./IEntity.js"
|
|
import NumberEntity from "./NumberEntity.js"
|
|
|
|
export default class VectorEntity extends IEntity {
|
|
|
|
static attributes = {
|
|
...super.attributes,
|
|
X: NumberEntity.withDefault(),
|
|
Y: NumberEntity.withDefault(),
|
|
Z: NumberEntity.withDefault(),
|
|
}
|
|
static grammar = Grammar.createEntityGrammar(VectorEntity, false)
|
|
|
|
constructor(values) {
|
|
super(values)
|
|
/** @type {NumberEntity} */ this.X
|
|
/** @type {NumberEntity} */ this.Y
|
|
/** @type {NumberEntity} */ this.Z
|
|
}
|
|
|
|
/** @returns {[Number, Number, Number]} */
|
|
toArray() {
|
|
return [this.X.valueOf(), this.Y.valueOf(), this.Z.valueOf()]
|
|
}
|
|
}
|