Commit 1ebb3060 authored by Matyáš Latner's avatar Matyáš Latner

#83 Prodleva před resetem po skončení naplánovaných akcí po kterých nebyl dosažen cíl

parent a7ae093a
......@@ -664,6 +664,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
if (result) {
performaNextAction(tileMap);
} else {
unregisterUpdateHandler();
performaErrorAction();
}
actionFinished = true;
......@@ -675,8 +676,16 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
});
} else {
unregisterUpdateHandler();
ResourceManager.getInstance().getSound(ResourceManager.ERROR).play();
performaErrorAction();
player.registerEntityModifier(new DelayModifier(FINISH_ACTION_DELAY, new EntityModifierListenerAdapter() {
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
performaErrorAction();
}
}));
}
} else {
secoundElapsed = secoundElapsed + pSecondsElapsed;
......@@ -709,12 +718,15 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
private void performaErrorAction() {
scene.unregisterUpdateHandler(this);
errorCount++;
resetGameState();
goToPlanningMode();
}
private void unregisterUpdateHandler() {
scene.unregisterUpdateHandler(this);
}
});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment