/**
 * \brief Function called when the count change.
 */
void ptb::honeypots_component::on_count_change()
{
  claw::tween::tweener_sequence tween;

  tween.insert
    ( claw::tween::single_tweener
      (get_position().y, get_active_position().y, 0.5,
       boost::bind
       ( &ptb::status_component::on_y_position_update,
         this, _1 ), &claw::tween::easing_back::ease_out ) );

  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().y, get_active_position().y, 2,
       boost::bind
       ( &ptb::status_component::on_y_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().y, get_inactive_position().y, 0.5,
       boost::bind
       ( &ptb::status_component::on_y_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  add_tweener( tween );
} // honeypots_component::on_count_change()
/**
 * \brief The fonction called when score changes.
 * \param s The new score.
 */
void ptb::score_component::on_score_changed(unsigned int s)
{
  std::ostringstream oss;
  oss << s;
  m_score.create(m_font, oss.str());
  m_score->set_intensity(1, 0.8, 0);

  update_inactive_position();

  claw::tween::tweener_sequence tween;

  tween.insert
    ( claw::tween::single_tweener
      (get_position().x, get_active_position().x, 0.3,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
         this, _1 ), &claw::tween::easing_back::ease_out ) );

  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_active_position().x, 1,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_inactive_position().x, 0.5,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  add_tweener( tween );
} // score_component::on_score_changed()
/**
 * \brief The fonction called when some throwable_item is added or removed.
 */
void ptb::throwable_item_component::on_throwable_item_changed()
{
  claw::tween::tweener_sequence tween;

  tween.insert
    ( claw::tween::single_tweener
      (get_position().x, get_active_position().x, 0.3,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
         this, _1 ), &claw::tween::easing_back::ease_out ) );

  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_active_position().x, 1,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );
  
  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().x, get_inactive_position().x, 0.5,
       boost::bind
       ( &ptb::status_component::on_x_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );

  add_tweener( tween ); 
} // throwable_item_component::on_throwable_item_changed()
/**
 * \brief Add tweener for moving corrupting bonus.
 */
void ptb::corrupting_bonus_component::move()
{
  claw::tween::tweener_sequence tween;

  tween.insert
    ( claw::tween::single_tweener
      (get_position().y, get_active_position().y, 0.3,
       boost::bind
       ( &ptb::status_component::on_y_position_update,
         this, _1 ), &claw::tween::easing_back::ease_out ) );
  
  tween.insert
	( claw::tween::single_tweener
	  (get_active_position().y, get_active_position().y, 1,
	   boost::bind
	   ( &ptb::status_component::on_y_position_update,
	     this, _1 ), &claw::tween::easing_back::ease_in ) );
      
  tween.insert
    ( claw::tween::single_tweener
      (get_active_position().y, get_inactive_position().y, 0.5,
       boost::bind
       ( &ptb::status_component::on_y_position_update,
	 this, _1 ), &claw::tween::easing_back::ease_in ) );

  add_tweener( tween );
} // corrupting_bonus_component::move()