コード例 #1
0
  private void initSequence(Animation parSequenceIndex) {
    // TODO
    // Should control here which animations are interruptible, in which priority
    // I.e. could reject certain changes depending on what current animation is playing

    // handle case where animation sequence isn't available
    if (mapOfSequences.get(parSequenceIndex) == null) {
      JurassiCraft.instance
          .getLogger()
          .error(
              "Requested an anim id "
                  + parSequenceIndex.toString()
                  + " that doesn't have animation sequence in map for entity "
                  + theEntity.getEntityId());
      currentSequence = Animations.IDLE.get();
      theEntity.setAnimation(Animations.IDLE.get());
    } else if (currentSequence != Animations.IDLE.get()
        && currentSequence == parSequenceIndex) // finished sequence but no new sequence set
    {
      //            JurassiCraft.instance.getLogger().debug("Intializing to idle sequence");
      currentSequence = Animations.IDLE.get();
      theEntity.setAnimation(Animations.IDLE.get());
    } else if (theEntity.isCarcass()) {
      currentSequence = Animations.DYING.get();
    } else {
      currentSequence = parSequenceIndex;
    }
  }
コード例 #2
0
  private void setNextSequence(Animation parSequenceIndex) {
    // TODO
    // Should control here which animations are interruptible, in which priority
    // I.e. could reject certain changes depending on what current animation is playing

    // handle case where animation sequence isn't available
    if (mapOfSequences.get(parSequenceIndex) == null) {
      JurassiCraft.instance
          .getLogger()
          .error(
              "Requested an anim id "
                  + parSequenceIndex.animationId
                  + " ("
                  + Animations.getAnimation(parSequenceIndex).toString()
                  + ") that doesn't have animation sequence in map for entity "
                  + theEntity.getEntityId());
      currentSequence = Animations.IDLE.get();
    } else if (currentSequence != Animations.IDLE.get()
        && currentSequence == parSequenceIndex) // finished sequence but no new sequence set
    {
      //            JurassiCraft.instance.getLogger().debug("Reverting to idle sequence");
      currentSequence = Animations.IDLE.get();
    } else {
      //            JurassiCraft.instance.getLogger().debug("Setting new sequence to " +
      // parSequenceIndex);
      currentSequence = parSequenceIndex;
    }

    theEntity.setAnimation(currentSequence);
    setNextPoseModel(0);
    startNextTween();

    //        if (currentSequence != Animations.IDLE)
    //        {
    //            JurassiCraft.instance.getLogger().debug("current sequence for entity ID " +
    // theEntity.getEntityId() + " is " + currentSequence + " out of " + mapOfSequences.size() + "
    // and current pose " + currentPose + " out of " + mapOfSequences.get(currentSequence).length +
    // " with " + numTicksInTween + " ticks in tween");
    //        }
  }