Sniper.cpp 716 B

1234567891011121314151617181920212223242526
  1. #include "Sniper.h"
  2. Sniper::Sniper(Persos_Gest* persosGest, bool allie)
  3. : IACtrl( persosGest, allie ), m_focusID( 65535 ), m_lastShot( 0 )
  4. {}
  5. Sniper::~Sniper()
  6. {}//Ne rien détruire
  7. void Sniper::update()
  8. {
  9. ///Rafraichit focus
  10. if ( !m_persosGest->getVivant( m_focusID, !m_allie) ) m_focusID = focusProche( !m_allie );
  11. ///Visee
  12. m_visee = m_persosGest->getPos( m_focusID, !m_allie ) - m_moi->getPos();
  13. ///Tir
  14. if ( SDL_GetTicks() - m_lastShot > 2500 ) { // Faut 2.5 secondes à un sniper pour viser
  15. m_lastShot = SDL_GetTicks();
  16. m_tir[ L_HAND ] = m_tir[ R_HAND ] = true;
  17. }
  18. else m_tir[ L_HAND ] = m_tir[ R_HAND ] = false;
  19. }
  20. ///END FICHIER