Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2011, 3:05:26 PM (13 years ago)
Author:
dafrick
Message:

Cleaning up game immersion. Roughly documenting weapons module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/weapons/RocketController.cc

    r7163 r8855  
    2121*
    2222*   Author:
    23 *     Gabriel Nadler, Originalfile: Oli Scheuss
     23*     Gabriel Nadler
    2424*   Co-authors:
    2525*      ...
     
    2727*/
    2828
     29/**
     30    @file BasicProjectile.h
     31    @brief Implementation of the BasicProjectile class.
     32*/
     33
    2934#include "RocketController.h"
     35
     36#include "util/Math.h"
     37#include "worldentities/pawns/Pawn.h"
    3038#include "projectiles/SimpleRocket.h"
    31 #include "util/Math.h"
    32 #include "weapons/projectiles/SimpleRocket.h"
    33 #include "util/Debug.h"
    34 #include "weapons/weaponmodes/SimpleRocketFire.h"
    35 #include "worldentities/pawns/Pawn.h"
     39#include "weaponmodes/SimpleRocketFire.h"
    3640
    3741namespace orxonox
     
    3943    /**
    4044    @brief
    41     Constructor.
     45        Constructor.
    4246    */
    4347    RocketController::RocketController(BaseObject* creator) : Controller(creator)
     
    4650        COUT(5)<< "RocketController constructed\n";
    4751
    48 
     52        // Create a rocket for the controller.
    4953        this->rocket_ = new SimpleRocket(this);
    5054        this->rocket_->setController(this);
     
    5559    /**
    5660    @brief
    57     The controlling happens here. This method defines what the controller has to do each tick.
     61        The controlling happens here. This method defines what the controller has to do each tick.
    5862    @param dt
    59     The duration of the tick.
     63        The duration of the tick.
    6064    */
    6165    void RocketController::tick(float dt)
    6266    {
    63 
    6467        if (this->target_ && this->rocket_->hasFuel()) {
    65             this->setTargetPosition();
    66             this->moveToTargetPosition();
     68            this->updateTargetPosition();
     69            this->moveToPosition(this->targetPosition_);
    6770        }
    68 
    69 
    7071    }
    71 
    7272
    7373    RocketController::~RocketController()
     
    7676    }
    7777
    78     void RocketController::setTargetPosition()
     78    /**
     79    @brief
     80        Update the position of the target.
     81    */
     82    void RocketController::updateTargetPosition()
    7983    {
    80         this->targetPosition_=this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
     84        this->targetPosition_ = this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
    8185        //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
    82     }
    83     void RocketController::moveToTargetPosition()
    84     {
    85         this->moveToPosition(this->targetPosition_);
    86     }
    87 
    88 
    89 
    90     void RocketController::setTarget(WorldEntity* target)
    91     {
    92         this->target_ = target;
    9386    }
    9487
     
    110103    }
    111104
    112 
    113 
    114 
    115105}
Note: See TracChangeset for help on using the changeset viewer.