mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-14 00:54:48 +08:00
25 lines
733 B
JavaScript
25 lines
733 B
JavaScript
import Grammar from "../serialization/Grammar.js"
|
|
import IEntity from "./IEntity.js"
|
|
import NumberEntity from "./NumberEntity.js"
|
|
|
|
export default class Vector2DEntity extends IEntity {
|
|
|
|
static attributes = {
|
|
...super.attributes,
|
|
X: NumberEntity.withDefault(),
|
|
Y: NumberEntity.withDefault(),
|
|
}
|
|
static grammar = Grammar.createEntityGrammar(this).label("Vector2DEntity")
|
|
|
|
constructor(values) {
|
|
super(values)
|
|
/** @type {InstanceType<typeof Vector2DEntity.attributes.X>} */ this.X
|
|
/** @type {InstanceType<typeof Vector2DEntity.attributes.Y>} */ this.Y
|
|
}
|
|
|
|
/** @returns {[Number, Number]} */
|
|
toArray() {
|
|
return [this.X.valueOf(), this.Y.valueOf()]
|
|
}
|
|
}
|