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