mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-17 05:47:34 +08:00
Still WIP
This commit is contained in:
@@ -1,34 +1,24 @@
|
||||
import Grammar from "../serialization/Grammar.js"
|
||||
import AttributeInfo from "./AttributeInfo.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
import NumberEntity from "./NumberEntity.js"
|
||||
|
||||
export default class Vector2DEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
X: new AttributeInfo({
|
||||
default: 0,
|
||||
expected: true,
|
||||
}),
|
||||
Y: new AttributeInfo({
|
||||
default: 0,
|
||||
expected: true,
|
||||
}),
|
||||
}
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
static createGrammar() {
|
||||
return Grammar.createEntityGrammar(this, false)
|
||||
X: NumberEntity.withDefault(),
|
||||
Y: NumberEntity.withDefault(),
|
||||
}
|
||||
static grammar = Grammar.createEntityGrammar(this, false)
|
||||
|
||||
constructor(values) {
|
||||
super(values)
|
||||
/** @type {Number} */ this.X
|
||||
/** @type {Number} */ this.Y
|
||||
/** @type {NumberEntity} */ this.X
|
||||
/** @type {NumberEntity} */ this.Y
|
||||
}
|
||||
|
||||
/** @returns {[Number, Number]} */
|
||||
toArray() {
|
||||
return [this.X, this.Y]
|
||||
return [this.X.valueOf(), this.Y.valueOf()]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user