Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9163 in orxonox.OLD


Ignore:
Timestamp:
Jul 4, 2006, 6:16:00 PM (18 years ago)
Author:
patrick
Message:

aiming system integration

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

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r9162 r9163  
    2929#include "weapons/cannon.h"
    3030#include "weapons/fps_sniper_rifle.h"
     31#include "weapons/aiming_system.h"
    3132
    3233#include "aabb.h"
  • branches/presentation/src/world_entities/creatures/fps_player.h

    r9162 r9163  
    99
    1010#include "playable.h"
     11
     12
     13class AimingSystem;
    1114
    1215
     
    2629
    2730    virtual void reset();
    28    
     31
    2932    virtual void destroy(WorldEntity* killer);
    3033    virtual void respawn();
     
    5760    float                 fallVelocity;        //!< velocity for falling down
    5861    float                 jumpForce;           //!< the jump force
    59    
     62
    6063    bool                  initWeapon;
     64
     65    AimingSystem*         aimingSystem;        //!< aiming system of the player
    6166};
    6267
  • branches/presentation/src/world_entities/weapons/aiming_system.cc

    r9160 r9163  
    7676/**
    7777 * get back the nearest target
     78 * @returns the nerest target
    7879 */
    7980inline WorldEntity* AimingSystem::getNearestTarget()
     
    8485    return this->selectionList.back();
    8586
    86 //   WorldEntity* nearestEntity = this->;
     87  WorldEntity* nearestEntity     = this->selectionList.back();
     88  float        distance          = 0.0f;
     89  float        smalestDistance   = this->range * 5.0f;
     90
    8791
    8892  for( int i = 0; i < this->selectionList.size(); i++)
    8993  {
     94    distance = fabs((this->getAbsCoor() - this->selectionList[i]->getAbsCoor()).len());
     95    if( distance < smalestDistance)
     96    {
     97      nearestEntity = this->selectionList[i];
     98      smalestDistance = distance;
     99    }
     100  }
    90101
    91   }
     102  return nearestEntity;
    92103}
    93104
     
    111122void AimingSystem::tick(float dt)
    112123{
     124
     125  this->selectionList.clear();
    113126}
    114127
Note: See TracChangeset for help on using the changeset viewer.