Exemple #1
0
  @Override
  public void setSpatial(Spatial spatial) {
    super.setSpatial(spatial);

    if (spatial != null) {
      animControl = ActorFactory.findControl(spatial, AnimControl.class);
      characterControl = ActorFactory.findControl(spatial, CharacterControl.class);
      if (animControl != null && characterControl != null) {
        initChannels();
        animControl.addListener(this);
      }
    }
  }
  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();
  }