home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / xenon / source / laserweapon.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-09  |  1.1 KB  |  52 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    CLaserWeapon
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    CWeapon
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #include "game.h"
  16.  
  17. //-------------------------------------------------------------
  18.  
  19. CLaserWeapon::CLaserWeapon()
  20. {
  21. }
  22.  
  23. //-------------------------------------------------------------
  24.  
  25. CLaserWeapon::~CLaserWeapon()
  26. {
  27. //    CWeapon::~CWeapon();
  28. }
  29.  
  30. //-------------------------------------------------------------
  31.  
  32. bool CLaserWeapon::fire()
  33. {
  34.     if (!isValidFiringPosition())
  35.         return false;    
  36.     
  37.     CLaser *l = new CLaser;
  38.     m_scene->addActor(l);
  39.  
  40.     l->activate();
  41.     l->setGrade((BulletGrade) m_grade);
  42.     l->setPosition(getPosition());
  43.     l->setVelocity(gsCVector(0.f,-l->getActorInfo().m_speed[m_grade]));
  44.  
  45.     if (getOwner() && getOwner()->getActorInfo().m_type == ACTOR_TYPE_SHIP)
  46.         CGameState::playSample(SAMPLE_FIRE_LASER,getPosition().getX());
  47.  
  48.     return true;
  49. }
  50.  
  51. //-------------------------------------------------------------
  52.