Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9175 in orxonox.OLD


Ignore:
Timestamp:
Jul 4, 2006, 10:31:46 PM (18 years ago)
Author:
bensch
Message:

better stuff

Location:
branches/presentation/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/effects/explosion.cc

    r9171 r9175  
    113113void Explosion::tick (float dt)
    114114{
    115   printf("%f %f\n", this->lifeCycle, this->lifeTime);
    116115  this->lifeCycle += dt;
    117116  if(this->lifeTime < this->lifeCycle)
  • branches/presentation/src/world_entities/npcs/attractor_mine.cc

    r9173 r9175  
    2525#include "debug.h"
    2626
     27#include "player.h"
     28#include "playable.h"
     29
    2730#include "loading/factory.h"
    2831#include "loading/load_param.h"
     
    3437
    3538AttractorMine::AttractorMine(const TiXmlElement* root)
    36   : NPC(NULL)
     39    : NPC(NULL)
    3740{
    3841  this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine");
     
    100103  glMultMatrixf((float*)matrix);
    101104
    102 //   if (this->shader != NULL && this->shader != Shader::getActiveShader())
    103 //     shader->activateShader();
     105  //   if (this->shader != NULL && this->shader != Shader::getActiveShader())
     106  //     shader->activateShader();
    104107
    105108  this->getModel()->draw();
    106 //   shader->deactivateShader();
     109  //   shader->deactivateShader();
    107110
    108111
    109 /*  if (this->model)
    110     this->model->draw();*/
     112  /*  if (this->model)
     113      this->model->draw();*/
    111114  glPopMatrix();
    112115}
     
    115118void AttractorMine::tick(float dt)
    116119{
    117 //  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
     120  PNode* attractNode = State::getPlayer()->getPlayable();
     121  if (attractNode != NULL)
     122  {
     123    if (this->distance(attractNode) < 80)
     124    {
     125      Vector dist = (attractNode->getAbsCoor() -  this->getAbsCoor());
     126      float distance = dist.len();
     127      this->velocity += dist * (( 250.0 - distance) / distance * dt);
     128    }
     129  }
     130
     131  this->shiftCoor(this->velocity * dt);
     132
     133  //  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
    118134
    119135  //if (directin.len() < 100)
    120 //  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
    121 //  this->shiftDir(Quaternion(dt, this->randomRotAxis));
     136  //  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
     137  //  this->shiftDir(Quaternion(dt, this->randomRotAxis));
    122138
    123139}
  • branches/presentation/src/world_entities/npcs/attractor_mine.h

    r9173 r9175  
    2626   Vector   randomRotAxis;
    2727   Shader*  shader;
     28
     29   Vector   velocity;
    2830};
    2931
Note: See TracChangeset for help on using the changeset viewer.