Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2005, 5:16:07 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: animations can now be stored inside of the Weapon-base-class

File:
1 edited

Legend:

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

    r4890 r4893  
    5353
    5454  this->objectComponent1 = new PNode();
    55   this->animation1 = new Animation3D(this->objectComponent1);
    56   this->animation2 = new Animation3D(this);
    57   this->animation3 = new Animation3D(this);
     55  Animation3D* animation1 = this->createAnimation(WS_SHOOTING, this->objectComponent1);
     56  Animation3D* animation2 = this->createAnimation(WS_ACTIVATING, this);
     57  Animation3D* animation3 = this->createAnimation(WS_DEACTIVATING, this);
    5858  //parent->addChild(this->objectComponent1, PNODE_ALL);
    5959  this->addChild(this->objectComponent1, PNODE_ALL);
    6060
    61   this->animation1->setInfinity(ANIM_INF_CONSTANT);
    62   this->animation2->setInfinity(ANIM_INF_CONSTANT);
    63   this->animation3->setInfinity(ANIM_INF_CONSTANT);
     61  animation1->setInfinity(ANIM_INF_CONSTANT);
     62  animation2->setInfinity(ANIM_INF_CONSTANT);
     63  animation3->setInfinity(ANIM_INF_CONSTANT);
    6464  if( this->leftRight == W_LEFT)
    6565    {
    6666      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    6767
    68       this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    69       this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    70       this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    71 
    72       this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    73       this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    74 
    75       this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    76       this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     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(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     73      animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     74
     75      animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     76      animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7777    }
    7878  else if( this->leftRight == W_RIGHT)
     
    8181
    8282      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
    83       this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    84       this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    85       this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    86 
    87       this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    88       this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    89 
    90       this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    91       this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     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(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     88      animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     89
     90      animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     91      animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    9292    }
    9393/*
     
    128128void TestGun::activate()
    129129{
    130   this->animation2->replay();
    131130}
    132131
     
    141140void TestGun::deactivate()
    142141{
    143   this->animation3->replay();
    144142}
    145143
     
    153151void TestGun::fire()
    154152{
    155   this->energyLoaded -= this->minCharge;
    156153  Projectile* pj =  new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
    157154//  weaponSource->play();
     
    161158  pj->setVelocity(this->getVelocity());
    162159  State::getWorldEntityList()->add(pj);
    163 
    164   this->animation1->replay();
    165160}
    166161
Note: See TracChangeset for help on using the changeset viewer.