エク
プロパティ
タイプ
インフォメーション
Currently, storing dynamically sized objects or lists isn’t supported. We’re actively exploring this feature and would love to hear about your specific use cases.
The following data types are useful for creating Schema properties on a Custom Component or references to a specific type.
Type | Description |
---|---|
ecs.eid | Entity Reference |
ecs.f32 | 32-bit floating-point number |
ecs.f64 | 64-bit floating-point number |
ecs.i32 | 32-bit integer |
ecs.ui8 | 8-bit unsigned integer |
ecs.ui32 | 32-bit unsigned integer |
ecs.string | String |
ecs.boolean | Boolean |
機能
登録コンポーネント
コンポーネントをECSに登録する。
ecs.registerComponent({
name: string,
schema: Schema,
data: Schema,
schemaDefaults: Object,
add: function
remove: function,
tick: function
})// -> コンポーネント・ハンドル
州
パラメータ | タイプ | 説明 |
---|---|---|
triggers(必須) | Record<String, Trigger[]> | このステートと遷移する次のステートの名前とそのトリガー。 |
onEnter | function | ステートに入る前に呼ばれる関数。 |
onExit | function | ステートに入る前に呼ば れる関数。 |
トリガー
イベントトリガー
パラメータ | タイプ | 説明 |
---|---|---|
type (必須) | constant: 'event' | トリガーのタイプを示す定数 |
event (必須) | string | このトリガーとなるイベントタイプ |
target | eid | このトリガーの状態を変更したいエンティティ |
beforeTransition | (event) => boolean | トランジションの前に実行される関数で、結果が真であればトランジションは終了し、状態は変化しない。 |
タイムアウトトリガー
パラメータ | タイプ | 説明 |
---|---|---|
type (必須) | constant: 'timeout' | トリガーのタイプを示す定数 |
timeout(必須) | number | 遷移するまでのミリ秒数 |