Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 25, 2008, 1:14:19 AM (16 years ago)
Author:
landauf
Message:

The SpaceShips HUD is working again (Speedbar and Radar)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/overlays/hud/HUDSpeedBar.cc

    r2087 r2256  
    3131#include "HUDSpeedBar.h"
    3232#include "core/CoreIncludes.h"
     33#include "objects/worldentities/pawns/SpaceShip.h"
     34#include "objects/items/Engine.h"
    3335
    3436namespace orxonox
     
    4143        RegisterObject(HUDSpeedBar);
    4244
     45        this->owner_ = 0;
    4346    }
    4447
     
    4952    void HUDSpeedBar::tick(float dt)
    5053    {
    51 /*
    52         SpaceShip* ship = SpaceShip::getLocalShip();
    53         if (ship)
     54        if (this->owner_ && this->owner_->getEngine())
    5455        {
    55             float v = ship->getVelocity().length();
    56             float value = v / ship->getMaxSpeed();
     56            float v = this->owner_->getVelocity().length();
     57            float value = v / (this->owner_->getEngine()->getMaxSpeedFront() * this->owner_->getEngine()->getSpeedFactor() * this->owner_->getEngine()->getBoostFactor());
    5758            if (value != this->getValue())
    5859                this->setValue(value);
    5960        }
    60 */
     61    }
     62
     63    void HUDSpeedBar::changedOwner()
     64    {
     65        SUPER(HUDSpeedBar, changedOwner);
     66
     67        this->owner_ = dynamic_cast<SpaceShip*>(this->getOwner());
    6168    }
    6269}
Note: See TracChangeset for help on using the changeset viewer.