更新ハンドラーを使用してスプライトのスケールを大きくしようとしています。ただし、シーン アクション アップ イベントを呼び出すことはできないため、スプライトのサイズは増加し続けます。アクションが起動したときに更新ハンドラーを中断するにはどうすればよいですか? これは私が持っているものです:
更新ハンドラー:
scene.registerUpdateHandler(new IUpdateHandler() {
@Override
public void reset() {
}
@Override
public void onUpdate(float pSecondsElapsed) {
if(fillerNum>-1){
if(filler[fillerNum].active){
mPhysicsWorld.unregisterPhysicsConnector(mPhysicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(filler[fillerNum].sprite));
mPhysicsWorld.destroyBody(filler[fillerNum].body);
filler[fillerNum].sprite.setScale(filler[fillerNum].scale+=pSecondsElapsed*3);
filler[fillerNum].body = PhysicsFactory.createCircleBody(mPhysicsWorld, filler[fillerNum].sprite, BodyType.DynamicBody, FIXTURE_DEF);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(filler[fillerNum].sprite, filler[fillerNum].body, true, true));
}
}
}
});
そしてシーンタッチイベント:
@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
if(this.mPhysicsWorld != null) {
if(pSceneTouchEvent.isActionDown()) {
createFiller(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
return true;
}
if(pSceneTouchEvent.isActionUp()){
Log.e("Action UP", Boolean.toString(filler[fillerNum].active));
createStationaryFiller();
}
}
return false;
}