次のようなコードがあるとします。
Crafty.c("SomeType",{//do something... });
var obj=Crafty.e("SomeType");
オブジェクトの型をチェックする機能があるかどうか誰か教えてもらえますか?
元:
Crafty.isComponent(obj,"SomeType")==true
また
Crafty.getComponents(obj)=="SomeType"
次のようなコードがあるとします。
Crafty.c("SomeType",{//do something... });
var obj=Crafty.e("SomeType");
オブジェクトの型をチェックする機能があるかどうか誰か教えてもらえますか?
元:
Crafty.isComponent(obj,"SomeType")==true
また
Crafty.getComponents(obj)=="SomeType"
ああ、Crafty.jsファイルから、コンポーネントをチェックするための.has()関数があることがわかりました。:)
/**@
* #.has
* @comp Crafty Core
* @sign public Boolean .has(String component)
* Returns `true` or `false` depending on if the
* entity has the given component.
*
* For better performance, simply use the `.__c` object
* which will be `true` if the entity has the component or
* will not exist (or be `false`).
*/