@Override public boolean run(ActionCallback cb) { setVerbCb(cb); World w = World.getInstance(); DialogOption o = World.getInstance().getCurrentDialog().getCurrentOption(); String playerText = o.getText(); responseText = o.getResponseText(); characterName = w.getCurrentDialog().getActor(); characterTurn = true; previousAnim = null; // If the player or the character is talking restore to 'stand' pose restoreStandPose(w.getCurrentScene().getPlayer()); if (w.getCurrentScene().getActor(characterName, false) instanceof SpriteActor) restoreStandPose((CharacterActor) w.getCurrentScene().getActor(characterName, false)); if (playerText != null) { CharacterActor player = World.getInstance().getCurrentScene().getPlayer(); // WorldCamera c = World.getInstance().getCamera(); // Vector3 p = c.scene2screen(pos.x, pos.y + player.getHeight()); World.getInstance() .getTextManager() .addSubtitle( playerText, player.getX(), player.getY() + player.getHeight(), false, Text.Type.TALK, Color.BLACK, this); startTalkAnim(player); } else { resume(); } return getWait(); }
@Override public void resume() { World w = World.getInstance(); BaseActor actor = w.getCurrentScene().getActor(characterName, false); if (characterTurn) { characterTurn = false; if (previousAnim != null) { SpriteActor player = World.getInstance().getCurrentScene().getPlayer(); player.startAnimation(previousAnim, null); } if (responseText != null) { // WorldCamera c = World.getInstance().getCamera(); // Vector3 p = c.scene2screen(pos.x, pos.y + actor.getHeight()); World.getInstance() .getTextManager() .addSubtitle( responseText, actor.getX(), actor.getY() + actor.getBBox().getBoundingRectangle().getHeight(), false, Text.Type.TALK, Color.BLACK, this); if (actor instanceof CharacterActor) { startTalkAnim((CharacterActor) actor); } } else { super.resume(); } } else { if (actor instanceof SpriteActor) { ((SpriteActor) actor).startAnimation(previousAnim, null); } super.resume(); } }