Package com.l2client.animsystem

Examples of com.l2client.animsystem.InputProvider


          try {
            JMEAnimationController con = null;
            if(ent.getChildren().size() > 0 && ((Node)ent.getChild(0)) != null && ((Node)ent.getChild(0)).getChildren().size() > 0)
              con = ((Node) ent.getChild(0)).getChild(0).getControl(JMEAnimationController.class);
            if (con != null) {
              InputProvider in = getInputFrom(en, ent);
              con.setInput(in);
//FIXME OEHAM twice done, see Attack sever packet
//            if(en.damageDealt > 0)
//              con.callAction(CallActions.DefaultAttack.toString(), in);
//            if(en.damageReceived > 0)
View Full Code Here


    }

  }

  private InputProvider getInputFrom(EnvironmentComponent en, Entity ent) {
    InputProvider p = new InputProvider();
    if (en.hidden)
      p.setInput(Acting.Hidden);
    else
      p.setInput(Acting.Open);

    TargetComponent tgt = (TargetComponent) Singleton.get().getEntityManager().getComponent(ent.getId(), TargetComponent.class);
    if (tgt != null && tgt.hasTarget()) {
     
      p.setInput(Target.Front);

      float dist = ent.getLocalTranslation().distance(
          tgt.pos);
      if (dist < 5f)
        p.setInput(Enemy.Close);
      else if (dist < 10f)
        p.setInput(Enemy.Near);
      else if (dist < 30f)
        p.setInput(Enemy.Far);
      else
        p.setInput(Enemy.None);
    } else {
      p.setInput(Enemy.None);
    }

    if (en.damageReceived > 0) {
      if (en.damageReceived >= 0) {
        p.setInput(Hurt.Light);
        p.setInput(HurtVector.Front);
      } else if (en.damageReceived >= 32) {
        p.setInput(Hurt.Severe);
        p.setInput(HurtVector.Front);
      } else if (en.damageReceived >= 128) {
        p.setInput(Hurt.Deadly);
        p.setInput(HurtVector.Front);
      }
      //TODO who is the one to decide on resetting this? this should go into an EnvSystem!!
      en.damageReceived = 0;
      en.damageReceivedType = 0;
    } else {
      p.setInput(Hurt.None);
      p.setInput(HurtVector.None);
    }
   
    if(en.damageDealt >= 0){
      if(en.damageDealt >0)
        p.setInput(AttackResult.Success);
      else
        p.setInput(AttackResult.Failure);
     
      p.setInput(AttackVector.Mid_Front);
      //TODO who is the one to decide on resetting this? this should go into an EnvSystem!!
      en.damageDealt = -1;
      en.damageDealtType = 0;
    } else {
      p.setInput(AttackResult.None);
    }

    if (en.teamHealthPercent > 80)
      p.setInput(Morale.High);
    else
      p.setInput(Morale.Normal);

    if(en.movement < 0){
      p.setInput(Direction.None);
      p.setInput(Speed.None);
    } else {
      p.setInput(Direction.Front);
      p.setInput(en.movement > 0 ? Speed.Run
            : Speed.Walk);
    }

    p.setInput(Weapon.OneHand);

    return p;
  }
View Full Code Here

      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(3);
      ret.setBlendTime(0.2f);
      ret.setLooping(false);
      InputProvider i = med.getInput();
      int v = rand.nextInt(4);
      //diversity for horizon
      String dir = "mid";
      if(v<=0)
        dir="hi";
      else if(v>=3)
        dir="lo";
      //diversity in case Hurt is none for left right front back
      if(i.getInput(HurtVector.class).equals(HurtVector.None)){
        switch(rand.nextInt(4)){
        case 0:i.setInput(HurtVector.Left);break;
        case 1:i.setInput(HurtVector.Right);break;
        default:break;
        }
      }
     
     
      switch(i.getInput(HurtVector.class)){
      case None:
      case Front:
      case Back:{ret.setName("defend_"+dir+"_stab");break;}
      case Left:{ret.setName("defend_"+dir+"_slashlr");break;}
      case Right:{ret.setName("defend_"+dir+"_slashrl");break;}
View Full Code Here

      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(4);
      ret.setBlendTime(0.05f);
      ret.setLooping(false);
      InputProvider i = med.getInput();
      switch (i.getInput(Hurt.class)) {
      case None:
        ret.setName("ready");
        break;
      case Light: {
        int j = rand.nextInt(10);
        String name;
        if (rand.nextInt(10) > 7) {
          name = "knockback_";
        } else {
          name = "knockback_move_";
        }

        switch (i.getInput(HurtVector.class)) {
        case None:
        case Front:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_front");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_left");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_right");
            break;
          }
          break;
        case Back:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_back");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_left");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_right");
            break;
          }
          break;
        case Left:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_left");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_front");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_back");
            break;
          }
          break;
        case Right:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_right");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_front");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_back");
            break;
          }
        }

        break;
      }
      case Severe: {
        ret.setLooping(false);
        ret.setKeep(1.0f);
        switch (i.getInput(HurtVector.class)) {
        case None:
        case Left:
        case Right:
          if (rand.nextInt(1) > 0)
            ret.setName("knockdown_backward_launch");
          else
            ret.setName("knockdown_forward_launch");
          break;
        case Front:
          ret.setName("knockdown_backward_launch");
          break;
        case Back:
          ret.setName("knockdown_forward_launch");
          break;

        }
        break;
      }
      case Deadly: {
        ret.setLooping(false);
        ret.setKeep(1.0f);
        switch (i.getInput(HurtVector.class)) {
        case None:
        case Front:
          ret.setName("die_backward");
          break;
        case Back:
View Full Code Here

      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setBlendTime(0.2f);
      ret.setLooping(false);
      ret.setLevel(3);
      InputProvider i = med.getInput();
      String ending = "_fail";
      if(AttackResult.Success.equals(i.getInput(AttackResult.class)))
          ending = "_success";
      if(Weapon.None.equals(i.getInput(Weapon.class)))
          ret.setName("at_hi_a_punch"+ending);
     
      switch(i.getInput(AttackVector.class)){

      case High_LeftRight:{ret.setName("at_hi_c_slashlr"+ending);break;}
      case High_RightLeft:{ret.setName("at_hi_c_slashrl"+ending);break;}
      case High_Front:{
          int n = rand.nextInt(1);
          if(n>0)
            ret.setName("at_hi_c_slashlr"+ending);
          else
            ret.setName("at_hi_c_slashrl"+ending);
         
          break;}
      case None://{ret.setName("");break;}//don't do this there is no anim "" this will blow
      case Mid_LeftRight:
      case Mid_RightLeft:
      case Mid_Front:
      case Low_LeftRight:
      case Low_RightLeft:
      case Low_Front:{ret.setName(getMidLowResult(i.getInput(AttackVector.class))+ending);break;}
      }
      log.info("DefaultAttack:->"+ret.getName());
      return ret;
    }
    return null;
View Full Code Here

    }
  }
 
  private void onValuesChanged() {
    if(target != null){
      InputProvider in = getInputFromModel();
      target.setInput(in);
    }
  }
View Full Code Here

      target = (JMEAnimationController)con;
    }
  }
 
  private InputProvider getInputFromModel(){
    InputProvider in = new InputProvider();
    in.setInput((Acting) jComboBox1.getSelectedItem());
    in.setInput((AttackResult) jComboBox2.getSelectedItem());
    in.setInput((AttackVector) jComboBox3.getSelectedItem());
    in.setInput((Direction) jComboBox4.getSelectedItem());
    in.setInput((Enemy) jComboBox5.getSelectedItem());
    in.setInput((Hurt) jComboBox6.getSelectedItem());
    in.setInput((HurtVector) jComboBox7.getSelectedItem());
    in.setInput((Morale) jComboBox8.getSelectedItem());
    in.setInput((Speed) jComboBox9.getSelectedItem());
    in.setInput((Target) jComboBox10.getSelectedItem());
    in.setInput((Weapon) jComboBox11.getSelectedItem());
    return in;
  }
View Full Code Here

*/
public class DefaultAction extends Action {

  @Override
  protected Animation evaluate(Mediator med) {
    InputProvider in = med.getInput();

    if (Speed.None.equals(in.getInput(Speed.class))) {
      return standingAnimation(med, in);
    } else {
      return movingAnimation(med, in);
    }

View Full Code Here

    Animation ret = null;
    if(med.forceLockCheck(Channels.AllChannels,1)){
      ret = med.getAnimation();
      ret.setLevel(1);
      ret.setChannel(med.getChannel(Channels.AllChannels));
      InputProvider in = med.getInput();
      switch(in.getInput(Target.class)){
      case Mid:  ret.setName("Jump");break;
      case High: ret.setName("HighJump");break;
      case Back: ret.setName("Backflip");break;
      default: ret.setName("JumpNoHeight");break;
      }
View Full Code Here

  }
 
  @Override
  protected Animation evaluate(Mediator med){
    Animation ret = null;
    InputProvider in = med.getInput();
    if(Movement.None.equals(in.getInput(Movement.class))){
      if(med.setLockCheck(Channels.AllChannels,1)){
        ret = med.getAnimation();
        if(rand.nextInt(9) > 5 ){
          ret.setName("Idle1");
        } else{
          if(rand.nextInt(1) > 0){
            ret.setName("Idle2");
          }else{
            ret.setName("Idle3");
          }
        }
        ret.setBlendTime(0.5f);
      }
    } else {
      if(med.setLockCheck(Channels.AllChannels,1)){
        ret = med.getAnimation();
        if(Acting.Hidden.equals(in.getInput(Acting.class))){
          ret.setName("Stealth");
          ret.setBlendTime(0.5f);
        } else {
          ret.setName("Walk");
          ret.setBlendTime(0.5f);
View Full Code Here

TOP

Related Classes of com.l2client.animsystem.InputProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.