Ejemplo n.º 1
0
  @Override
  public void onOperateComplete() {

    if (curAction instanceof HeroAction.Unlock) {

      if (theKey != null) {
        theKey.detach(belongings.backpack);
        theKey = null;
      }

      int doorCell = ((HeroAction.Unlock) curAction).dst;
      int door = Dungeon.level.map[doorCell];

      Level.set(doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT);
      GameScene.updateMap(doorCell);

    } else if (curAction instanceof HeroAction.OpenChest) {

      if (theKey != null) {
        theKey.detach(belongings.backpack);
        theKey = null;
      }

      Heap heap = Dungeon.level.heaps.get(((HeroAction.OpenChest) curAction).dst);
      if (heap.type == Type.SKELETON) {
        Sample.INSTANCE.play(Assets.SND_BONES);
      }
      heap.open(this);
    }
    curAction = null;

    super.onOperateComplete();
  }
Ejemplo n.º 2
0
  @Override
  public void onComplete(Animation anim) {

    if (animCallback != null) {
      animCallback.call();
      animCallback = null;
    } else {

      if (anim == attack) {

        idle();
        ch.onAttackComplete();

      } else if (anim == zap) {
        idle();
        ch.onZapComplete();

      } else if (anim == operate) {

        idle();
        ch.onOperateComplete();
      }
    }
  }