Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 7, 2005, 10:32:23 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: many loadParams

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapons/test_gun.cc

    r4966 r4972  
    3939using namespace std;
    4040
     41CREATE_FACTORY(TestGun);
    4142
    4243/**
     
    4849  : Weapon(weaponManager)
    4950{
    50   this->setClassID(CL_TEST_GUN, "TestGun");
    51 
    52   this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
    5351  this->leftRight = leftRight;
    5452
     
    6361  animation2->setInfinity(ANIM_INF_CONSTANT);
    6462  animation3->setInfinity(ANIM_INF_CONSTANT);
     63
    6564  if( this->leftRight == W_LEFT)
    66     {
    67       this->setEmissionPoint(1.0, 0.0, -0.35);
    68 
    69       animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    70       animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    71       animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    72 
    73       animation2->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    74       animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    75 
    76       animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    77       animation3->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    78     }
     65  {
     66    this->setEmissionPoint(1.0, 0.0, -0.35);
     67
     68    animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     69    animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     70    animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     71
     72    animation2->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     73    animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     74
     75    animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     76    animation3->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     77  }
    7978  else if( this->leftRight == W_RIGHT)
    80     {
    81       this->setEmissionPoint(1.0, 0.0, 0.5);
    82 
    83       this->objectComponent1->setRelCoor(Vector(0,0,0.35));
    84       animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    85       animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    86       animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    87 
    88       animation2->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    89       animation2->addKeyFrame(Vector(.0, .0, .0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    90 
    91       animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    92       animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    93     }
    94 /*
    95   this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
    96   this->weaponSource = new SoundSource(this->fireSound, this);
    97   this->weaponSource->setRolloffFactor(.1);*/
    98   Projectile* p = new TestBullet();
    99 
    100   //  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
    101   //ObjectManager::getInstance()->debug();
     79  {
     80    this->setEmissionPoint(1.0, 0.0, 0.5);
     81
     82    this->objectComponent1->setRelCoor(Vector(0,0,0.35));
     83    animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     84    animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     85    animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     86
     87    animation2->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     88    animation2->addKeyFrame(Vector(.0, .0, .0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     89
     90    animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     91    animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     92  }
     93}
     94
     95
     96TestGun::TestGun(const TiXmlElement* root)
     97{
     98  this->init();
     99  this->loadParams(root);
     100}
     101
     102/**
     103 *  standard deconstructor
     104*/
     105TestGun::~TestGun ()
     106{
     107  // model will be deleted from WorldEntity-destructor
     108}
     109
     110
     111void TestGun::init()
     112{
     113  this->setClassID(CL_TEST_GUN, "TestGun");
     114
     115  this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
    102116
    103117  this->setStateDuration(WS_SHOOTING, .4);
     
    117131
    118132
    119 /**
    120  *  standard deconstructor
    121 */
    122 TestGun::~TestGun ()
    123 {
    124   // model will be deleted from WorldEntity-destructor
     133void TestGun::loadParams(const TiXmlElement* root)
     134{
     135
     136
    125137}
    126138
Note: See TracChangeset for help on using the changeset viewer.