コード例 #1
0
  public CreepAnimControl(Creep creep) {
    this.creep = creep;

    // animations of creep
    animControl = creep.getCreepModel().getControl(AnimControl.class);
    animControl.addListener(this);

    // chanels
    channelAttack = animControl.createChannel();
    channelDead = animControl.createChannel();
    channelRunBase = animControl.createChannel();
    channelRunTop = animControl.createChannel();

    // random tool
    random = new Random();
  }
コード例 #2
0
 // Gerneral function
 void setupPlayerControl() {
   this.animControl = ((Node) spatial).getChild("PlayerMesh").getControl(AnimControl.class);
   animChannel = animControl.createChannel();
   if (playerInfo.getRole().equals(PlayerRole.GoalKeeper)) {
     animChannel.setAnim("Idle");
     chasingBall = false;
   } else {
     animChannel.setAnim("RunFast");
     chasingBall = true;
   }
 }
コード例 #3
0
 @Override
 public void setEnabled(boolean enabled) {
   // Pause and unpause
   super.setEnabled(enabled);
   if (enabled) {
     gameGUIManager.loadAndGotoScreen("editPlayer");
     model = (Node) app.getAssetManager().loadModel("Models/Player/PlayerAni.j3o");
     app.getRootNode().attachChild(model);
     app.getFlyByCamera().setDragToRotate(true);
     playerModel = (Node) model.getChild("PlayerMesh");
     AnimControl animControl = playerModel.getControl(AnimControl.class);
     AnimChannel animChannel = animControl.createChannel();
     animChannel.setAnim("Idle");
     // System.out.println("Call me!");
     app.getCamera().setLocation(model.getChild("CamNode").getWorldTranslation());
     app.getCamera().lookAt(model.getChild("LookAtNode").getWorldTranslation(), Vector3f.UNIT_Y);
   } else {
   }
 }
コード例 #4
0
  /** Plays the specified animation or does nothing if the animation is not mapped. */
  public void play(String animation) {
    log.debug("play(" + animation + ")");

    if (Objects.equal(this.animation, animation)) {
      return;
    }

    List<Mapping> list = getMappings(animation, false);
    if (list == null) {
      list = getMappings(defaultAnimation, false);
      if (list == null) {
        // Just clear everything and hope for the best
        anim.clearChannels();
        return;
      }
    }

    // Make sure there are enough channels
    while (anim.getNumChannels() < list.size()) {
      anim.createChannel();
    }

    // Set the channels to the appropriate animation
    int i;
    for (i = 0; i < list.size(); i++) {
      Mapping m = list.get(i);
      AnimChannel channel = anim.getChannel(i);
      channel.setAnim(m.animation);
      channel.setSpeed(m.speed);
    }

    // Reset the rest
    for (; i < anim.getNumChannels(); i++) {
      AnimChannel channel = anim.getChannel(i);
      channel.reset(true);
    }
  }
コード例 #5
0
ファイル: AnimationManager.java プロジェクト: Grasia/phatsim
  private void initChannels() {
    fullBodyChannel = animControl.createChannel();
    headChannel.setLoopMode(LoopMode.Loop);

    headChannel = animControl.createChannel();
    headChannel.setLoopMode(LoopMode.Loop);

    leftArmChannel = animControl.createChannel();
    leftArmChannel.setLoopMode(LoopMode.Loop);

    rightArmChannel = animControl.createChannel();
    rightArmChannel.setLoopMode(LoopMode.Loop);

    leftLegChannel = animControl.createChannel();
    leftLegChannel.setLoopMode(LoopMode.Loop);

    rightLegChannel = animControl.createChannel();
    rightLegChannel.setLoopMode(LoopMode.Loop);
  }
コード例 #6
0
ファイル: AnimationManager.java プロジェクト: Grasia/phatsim
 private AnimChannel createRightArmChannels() {
   AnimChannel channel = animControl.createChannel();
   channel.addFromRootBone("RightShoulder");
   return channel;
 }
コード例 #7
0
ファイル: AnimationManager.java プロジェクト: Grasia/phatsim
 private AnimChannel createNeckChannel() {
   AnimChannel channel = animControl.createChannel();
   channel.addFromRootBone("Neck");
   return channel;
 }
コード例 #8
0
ファイル: AnimationManager.java プロジェクト: Grasia/phatsim
 private void setAnimationFullBody(String animationName, float blendTime, LoopMode loopMode) {
   animControl.clearChannels();
   fullBodyChannel = animControl.createChannel();
   fullBodyChannel.setLoopMode(loopMode);
   fullBodyChannel.setAnim(animationName, blendTime);
 }