Пример #1
0
 public TouchableEntity getTouchableEntity(AgentEntity agentEntity) {
   TouchableEntity touchableEntity = new TouchableEntity();
   DamageEffect damageEffect = new DamageEffect();
   damageEffect.setDamage(damage);
   damageEffect.setOriginatingAgent(agentEntity);
   touchableEntity.setCollisionPolygon(new Polygon(attackPolygon.getVertices()));
   Vector2 attackPosition = new Vector2();
   if (agentEntity.isFacingLeft()) {
     attackPosition
         .add(agentEntity.getLeftBoundingSide())
         .sub(attackPolygon.getBoundingRectangle().width, 0);
   } else {
     attackPosition.add(agentEntity.getRightBoundingSide());
   }
   touchableEntity.setPosition(attackPosition);
   return touchableEntity;
 }