Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc @ 10709

Last change on this file since 10709 was 10709, checked in by gania, 9 years ago

Restructured

File size: 3.8 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      Dominik Solenicki
26 *
27 */
28
29#include "LeaderController.h"
30
31
32
33namespace orxonox
34{
35
36    RegisterClass(LeaderController);
37
38    LeaderController::LeaderController(Context* context) : WingmanController(context)
39    {
40
41        RegisterObject(LeaderController);
42        //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&LeaderController::action, this)));
43    }
44
45
46    LeaderController::~LeaderController()
47    {
48    }
49
50    void LeaderController::action()
51    {
52        //this->target_ = this->sectionTarget_;       
53    }
54    /*
55    Wingmen and Leaders attack target_, which is a member variable of their classes.
56    Wingmen's target_ is set to sectionTarget_, which is a member variable of SectionController class, unless
57    Wingman covers Leader's rear.
58    Leader's target_ must always equal sectionTarget_.
59    if section has a target, its Leader shoots at it, but doesn't follow.
60    Every section is a part of division. Division consisting of one Section is still a division.
61    Division's leader's target_ must always equal divisionTarget_, which is a member variable of DivisionController.
62    Division leader ONLY can follow target_ while in formation flight.
63    If Division doesn't have a target, Division Leader stays in place, unless it has a waypoint.
64    Division Leader's sectionTarget_ must equal divisionTarget_,
65    but the other section, that is not a leading section, can attack any target that is near divisonTarget_
66
67    */
68    void LeaderController::tick(float dt)
69    {/*
70        if (!this->isActive())
71            return;
72       
73        //--------------------------Stay in division--------------------------
74        this->keepDivisionTick();*/
75        /*keepDivisionTick(){
76            if (this->divisionLeader_ && this->divisionLeader_->getControllableEntity() && desiredRelativePosition_){
77                Vector3 desiredAbsolutePosition = ((this->divisionLeader_->getControllableEntity()->getWorldPosition()) +
78                    (this->divisionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
79                this->moveToPosition (desiredAbsolutePosition);
80            }
81        }
82        */
83        /*//If ordered to attack -> follow target and shoot
84        if (this->bAttackOrder_)
85        {
86 
87        }
88        //If ordered to move -> move to a target Point
89       
90        //No orders -> Don't move, but shoot at whatever is close, unless Boss is shooting at it.
91        //(Section shoots same target, Boss's section shoots another target)
92        {
93
94        }*/
95
96        orxout(internal_error) << "my Wingman is " << this->wingman_ << endl;
97       
98        SUPER(LeaderController, tick, dt);
99    }
100    void LeaderController::setWingman(WingmanController* wingman)
101    {
102        this->wingman_ = wingman;
103    }
104//**********************************************NEW
105   /* void LeaderController::defaultBehaviour(float maxrand)
106    { 
107       
108    }*/
109
110}
Note: See TracBrowser for help on using the repository browser.