home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 04 Christian / wonfight.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-03  |  604 b   |  45 lines

  1.  
  2. #include "character.h"
  3. #include "WonFight.h"
  4. #include "gametime.h"
  5. #include "util.h"
  6.  
  7. WonFight::WonFight()
  8. {
  9.     m_name      = "WonFight";
  10.     m_owner     = NULL;
  11. }
  12.  
  13. void WonFight::init   ( IEOwner * owner )
  14. {
  15.     m_owner = dynamic_cast<Character *> (owner);
  16. }
  17.  
  18.  
  19. bool WonFight::update () 
  20. {
  21.     Character * enemy = m_owner->getEnemy();
  22.  
  23.     if ( enemy )
  24.     {
  25.         if ( enemy->getHealth() <= 0 )
  26.         {
  27.             return true;
  28.         }
  29.     }
  30.  
  31.     return false;
  32. }
  33.  
  34.  
  35. IEOwner * WonFight::getOwner ()
  36. {
  37.     return m_owner;
  38. }
  39.  
  40. const char * WonFight::getName()
  41. {
  42.     return m_name.c_str();
  43. }
  44.  
  45.