Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 29, 2006, 5:15:10 PM (17 years ago)
Author:
marcscha
Message:

fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/weapons/heavy_blaster.cc

    r9972 r9975  
    11#include "heavy_blaster.h"
     2#include "world_entities/projectiles/projectile.h"
     3
     4#include "world_entity.h"
     5#include "static_model.h"
     6#include "weapon_manager.h"
     7#include "util/loading/factory.h"
     8
     9#include "animation3d.h"
     10
     11#include "loading/fast_factory.h"
     12
     13CREATE_FACTORY(HeavyBlaster);
     14/**
     15 * Standard constructor
     16 */
     17HeavyBlaster::HeavyBlaster ()
     18 : Weapon()
     19{
     20    this->init();
     21}
    222
    323HeavyBlaster::HeavyBlaster (const TiXmlElement* root = NULL)
    424 : Weapon()
    5   {
     25{
    626    this->init();
    727    if (root != NULL)
    828      this->loadParams(root);
    9   }
     29}
    1030
    1131/**
     
    1333 */
    1434HeavyBlaster::~HeavyBlaster()
    15   {
     35{
    1636      // model will be deleted from WorldEntity-destructor
    17   }
     37}
     38
     39void HeavyBlaster::loadParams(const TiXmlElement* root)
     40{
     41  Weapon::loadParams(root);
     42}
     43
     44void HeavyBlaster::init()
     45{
     46  //this->registerObject(this, HeavyBlaster::_objectList);
     47
     48//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
     49
     50  this->loadModel("models/guns/plasmadriver_#.obj", 1.0);
     51 
     52
     53  this->setStateDuration(WS_SHOOTING, 0.05);
     54  this->setStateDuration(WS_RELOADING, 0);
     55  this->setStateDuration(WS_ACTIVATING, .5);
     56  this->setStateDuration(WS_DEACTIVATING, 1);
     57
     58  this->setEnergyMax(5000);
     59  this->increaseEnergy(5000);
     60  //this->minCharge = 2;
     61
     62  this->setActionSound(WA_SHOOT, "sound/laser.wav");
     63  this->setActionSound(WA_ACTIVATE, "sound/voices/lasers.wav");
     64  this->setActionSound(WA_RELOAD, "sound/spawn/alien_generator.wav");
     65
     66  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
     67  this->setProjectileTypeC("RailProjectile");   // FIXME temp project type until the blaste class exist
     68  this->prepareProjectiles(100);
     69
     70  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     71  Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this);
     72
     73  animation2->setInfinity(ANIM_INF_CONSTANT);
     74  animation3->setInfinity(ANIM_INF_CONSTANT);
     75
     76  this->setEmissionPoint(3.8, 1.2, 0);
     77
     78  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     79  animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5, ANIM_LINEAR, ANIM_NULL);
     80
     81  animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5, ANIM_LINEAR, ANIM_NULL);
     82  animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     83}
    1884
    1985
     86void HeavyBlaster::fire()
     87{
     88  Projectile* pj =  this->getProjectile();
     89  if (pj == NULL)
     90    return;
     91
     92  // set the owner
     93  pj->setOwner(this->getOwner());
     94
     95  pj->setParent(PNode::getNullParent());
     96
     97  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
     98
     99  pj->setAbsCoor(this->getEmissionPoint());
     100  pj->setAbsDir(this->getAbsDir());
     101  pj->activate();
     102}
     103
     104/**
     105 *  this activates the weapon
     106*/
     107void HeavyBlaster::activate()
     108{
     109}
     110
     111/**
     112 *  this deactivates the weapon
     113*/
     114void HeavyBlaster::deactivate()
     115{
     116}
     117
     118void HeavyBlaster::draw() const
     119{
     120}
Note: See TracChangeset for help on using the changeset viewer.