1234567891011121314151617181920212223242526 |
- #include "Sniper.h"
- Sniper::Sniper(Persos_Gest* persosGest, bool allie)
- : IACtrl( persosGest, allie ), m_focusID( 65535 ), m_lastShot( 0 )
- {}
- Sniper::~Sniper()
- {}//Ne rien détruire
- void Sniper::update()
- {
- ///Rafraichit focus
- if ( !m_persosGest->getVivant( m_focusID, !m_allie) ) m_focusID = focusProche( !m_allie );
- ///Visee
- m_visee = m_persosGest->getPos( m_focusID, !m_allie ) - m_moi->getPos();
- ///Tir
- if ( SDL_GetTicks() - m_lastShot > 2500 ) { // Faut 2.5 secondes à un sniper pour viser
- m_lastShot = SDL_GetTicks();
- m_tir[ L_HAND ] = m_tir[ R_HAND ] = true;
- }
- else m_tir[ L_HAND ] = m_tir[ R_HAND ] = false;
- }
- ///END FICHIER
|