Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10958


Ignore:
Timestamp:
Dec 8, 2015, 1:02:25 PM (8 years ago)
Author:
gania
Message:

separated MasterController from my hierarchy

Location:
code/branches/campaignHS15
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/data/levels/AITest.oxw

    r10953 r10958  
    162162<!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
    163163<!-- HERE STARTS DEMO FOR FIGHTING -->
    164    
     164    <!--
    165165
    166166    <SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="d1sd1">
     
    238238        </WingmanController>
    239239      </controller>
    240     </SpaceShip>
     240    </SpaceShip>  -->
    241241
    242242<!-- HERE ENDS DEMO FOR FIGHTING -->
    243243<!-- HERE STARTS DEMO FOR FORMATIONS -->
    244     <!--
     244   
    245245    <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
    246246    <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
     
    291291      </controller>
    292292    </SpaceShip>
    293     -->
     293   
    294294<!-- HERE ENDS DEMO FOR FORMATIONS -->
    295295    <!-- 1 division is roughly equal to 6 AIControllers--!>
  • code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc

    r10955 r10958  
    298298            }
    299299        }
    300 
    301 
    302300    }
    303301    /**
     
    307305    void ActionpointController::setProtect (ControllableEntity* protect)
    308306    {
    309 
    310307        this->protect_ = protect;
    311308    }
    312309    ControllableEntity* ActionpointController::getProtect ()
    313310    {
    314 
    315311        return this->protect_;
    316312    }
  • code/branches/campaignHS15/src/orxonox/controllers/FightingController.h

    r10955 r10958  
    6060            virtual void maneuver(); //<! sets this->targetPosition_, which is a Vector3 of where this ship flies. Decision is made based on
    6161                             //<! the distance to enemy, if being attacked, dodge() is called, otherwise ship just flies towards this->target_.
    62             bool bShooting_;
     62            bool bShooting_;    //<! if true, ship shoots each tick
    6363            bool canFire(); //<! check if target_ is in radius and if this is looking at target_
    64             virtual void action(){};//<! action() is called in regular intervals managing the bot's behaviour. Only gets called by MasterController, is implemented in ActionpointController
    6564        protected:
    6665            void setTarget(ControllableEntity* target); //set a target to shoot at
  • code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc

    r10946 r10958  
    4545        this->spread_ = 200;
    4646        this->tolerance_ = 80;
     47        this->bCopyOrientation_ = true;
    4748    }
    4849    FlyingController::~FlyingController()
     
    266267             + (orient* (targetRelativePosition)));
    267268        //let ship finish rotating. also don't call copyOrientation too often as it is a slow function. Don't know how to do it different
    268         if (static_cast<int>(rnd(1.0f) * 100) % 3 == 0)
     269        if (this->bCopyOrientation_)
    269270            this->setTargetOrientation (orient);
    270271        //set a position to fly to
  • code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h

    r10946 r10958  
    7272            FormationMode::Value getFormationMode() const
    7373                { return this->formationMode_; }
    74 
     74            bool bCopyOrientation_;                             //<! set to true by default, MasterController sets it in its tick(),
     75                                                                //<! if true, this will set its leader orientation as target orientation in action()
    7576        protected:
    7677            void stopMoving();                                  //<! don't call moveToTargetPosition() in tick, call lookAtTarget() from FightingController instead
     
    8687            void setTargetOrientation(ControllableEntity* target);      //<! preset a desired orientation
    8788            virtual void boostControl();                                //<! boost if you can
    88             void keepFormation (const ControllableEntity* leaderEntity, Vector3& targetRelativePosition);   //<! preset targetPosition, so that
    89                                                                                                             //<! this stays in a certain position relative to leader     
     89            void keepFormation (const ControllableEntity* leaderEntity,
     90                                Vector3& targetRelativePosition);   //<! preset targetPosition, so that
     91                                                                    //<! this stays in a certain position relative to leader     
    9092           
    9193            FormationMode::Value formationMode_;
  • code/branches/campaignHS15/src/orxonox/controllers/MasterController.cc

    r10955 r10958  
    3535
    3636    //Leaders share the fact that they have Wingmans
    37     MasterController::MasterController(Context* context) : FightingController(context)
     37    MasterController::MasterController(Context* context) : Controller(context)
    3838    {
    3939        RegisterObject(MasterController);
     
    120120                }
    121121                //orxout (internal_error) << "Executing action of Controller # " << this->indexOfCurrentController_ << endl;
    122                 this->controllers_.at(this->indexOfCurrentController_)->action();
     122                this->controllers_.at(this->indexOfCurrentController_)->action();   
     123                //bCopyOrientation makes ship oscillate like crazy if set to true all the time.s
     124                this->controllers_.at(this->indexOfCurrentController_)->bCopyOrientation_ = this->ticks_ % 3 == 0;
    123125
    124126                ++this->numberOfTicksPassedSinceLastActionCall_;
  • code/branches/campaignHS15/src/orxonox/controllers/MasterController.h

    r10955 r10958  
    3030#define _MasterController_H__
    3131
    32 #include "controllers/FightingController.h"
     32#include "controllers/Controller.h"
     33#include "controllers/ActionpointController.h"
    3334#include "tools/interfaces/Tickable.h"
    3435
     
    5051      </Pawn>
    5152    */
    52     class _OrxonoxExport MasterController : public FightingController, public Tickable
     53    class _OrxonoxExport MasterController : public Controller, public Tickable
    5354    {
    5455        public:
     
    6768         
    6869        private:
    69             std::vector<WeakPtr<FightingController> > controllers_;  //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
     70            std::vector<WeakPtr<ActionpointController> > controllers_;  //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
    7071            size_t indexOfCurrentController_;                        //<! index of current controller
    7172            unsigned int numberOfTicksPassedSinceLastActionCall_;
Note: See TracChangeset for help on using the changeset viewer.