Example #1
0
  /**
   * Constructor.
   *
   * @param resMgr
   * @param entity
   */
  public HunterVisual(ResourceManager resMgr, Entity entity) {
    super(entity);

    m_hunter = (Hunter) entity;

    // load animations
    Animation aimingAnimation =
        resMgr.getResource(Animation.class, "khaky_birds_prototype/animations/hunter/aiming.xml");
    Animation shootAnimation =
        resMgr.getResource(
            Animation.class, "khaky_birds_prototype/animations/hunter/shootAnimation.xml");
    Animation shittedAnimation =
        resMgr.getResource(
            Animation.class, "khaky_birds_prototype/animations/hunter/shittedAnimation.xml");

    // create an animation player
    m_animationPlayer = new AnimationPlayer();
    ANIM_AIM = m_animationPlayer.addAnimation(aimingAnimation);
    ANIM_SHOOT = m_animationPlayer.addAnimation(shootAnimation);
    ANIM_SHITTED = m_animationPlayer.addAnimation(shittedAnimation);
  }
Example #2
0
  @Override
  public void draw(SpriteBatcher batcher, Camera2D camera, float deltaTime) {
    Vector3 pos = m_hunter.getPosition();
    BoundingBox bs = m_hunter.getBoundingShape();

    // select an animation appropriate to the state the pedestrian's in
    switch (m_hunter.m_state) {
      case Aiming:
        {
          m_animationPlayer.select(ANIM_AIM);
          break;
        }
      case AimingZombie:
        {
          m_animationPlayer.select(ANIM_AIM);
          break;
        }

      case Shooting:
        {
          m_animationPlayer.select(ANIM_SHOOT);
          break;
        }
      case ShootingZombie:
        {
          m_animationPlayer.select(ANIM_SHOOT);
          break;
        }

      case S*****d:
        {
          m_animationPlayer.select(ANIM_SHITTED);
          break;
        }
      case Eaten:
        {
          m_animationPlayer.select(ANIM_AIM);
          break;
        }
    }

    // draw the hunter
    batcher.drawSprite(
        pos.m_x,
        pos.m_y,
        bs.getWidth(),
        bs.getHeight(),
        m_hunter.getFacing(),
        m_animationPlayer.getTextureRegion(m_hunter, deltaTime));
  }