[10678] | 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 "DivisionController.h" |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | namespace orxonox |
---|
| 33 | { |
---|
| 34 | |
---|
| 35 | RegisterClass(DivisionController); |
---|
[10725] | 36 | static const float ACTION_INTERVAL = 1.0f; |
---|
[10678] | 37 | |
---|
[10709] | 38 | DivisionController::DivisionController(Context* context) : LeaderController(context) |
---|
[10678] | 39 | { |
---|
| 40 | RegisterObject(DivisionController); |
---|
[10725] | 41 | this->setFormationMode(WALL); |
---|
| 42 | |
---|
[10717] | 43 | bIsDivisionLeader_ = true; |
---|
[10725] | 44 | this->myFollower_ = 0; |
---|
| 45 | this->myWingman_ = 0; |
---|
| 46 | this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this))); |
---|
| 47 | |
---|
[10678] | 48 | } |
---|
| 49 | |
---|
| 50 | DivisionController::~DivisionController() |
---|
| 51 | { |
---|
[10725] | 52 | |
---|
| 53 | } |
---|
| 54 | void DivisionController::tick(float dt) |
---|
[10718] | 55 | { |
---|
[10722] | 56 | SUPER(DivisionController, tick, dt); |
---|
[10718] | 57 | |
---|
[10678] | 58 | } |
---|
[10725] | 59 | void DivisionController::action() |
---|
| 60 | { |
---|
| 61 | /* setDesiredPositionOfFollower(); |
---|
| 62 | setDesiredPositionOfWingman();*/ |
---|
| 63 | } |
---|
| 64 | |
---|
[10717] | 65 | bool DivisionController::setFollower(LeaderController* myFollower) |
---|
[10709] | 66 | { |
---|
[10717] | 67 | if (!this->myFollower_) |
---|
| 68 | { |
---|
| 69 | this->myFollower_ = myFollower; |
---|
| 70 | return true; |
---|
| 71 | } |
---|
| 72 | else |
---|
| 73 | { |
---|
| 74 | return false; |
---|
| 75 | } |
---|
[10709] | 76 | } |
---|
[10725] | 77 | |
---|
| 78 | /* void DivisionController::setDesiredPositionOfWingman() |
---|
| 79 | { |
---|
| 80 | if (!this->myWingman_) |
---|
| 81 | return; |
---|
| 82 | |
---|
| 83 | switch (this->formationMode_){ |
---|
| 84 | case WALL: |
---|
| 85 | { |
---|
| 86 | myWingman_->desiredRelativePosition_ = new Vector3 (200, 0, 0); |
---|
| 87 | break; |
---|
| 88 | } |
---|
| 89 | case FINGER4: |
---|
| 90 | { |
---|
| 91 | break; |
---|
| 92 | } |
---|
| 93 | case VEE: |
---|
| 94 | { |
---|
| 95 | break; |
---|
| 96 | } |
---|
| 97 | case DIAMOND: |
---|
| 98 | { |
---|
| 99 | break; |
---|
| 100 | } |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | } |
---|
| 104 | void DivisionController::setDesiredPositionOfFollower() |
---|
| 105 | { |
---|
| 106 | if (!this->myFollower_) |
---|
| 107 | return; |
---|
| 108 | |
---|
| 109 | switch (this->formationMode_){ |
---|
| 110 | case WALL: |
---|
| 111 | { |
---|
| 112 | myWingman_->desiredRelativePosition_ = new Vector3 (-200, 0, 0); |
---|
| 113 | break; |
---|
| 114 | } |
---|
| 115 | case FINGER4: |
---|
| 116 | { |
---|
| 117 | break; |
---|
| 118 | } |
---|
| 119 | case VEE: |
---|
| 120 | { |
---|
| 121 | break; |
---|
| 122 | } |
---|
| 123 | case DIAMOND: |
---|
| 124 | { |
---|
| 125 | break; |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | }*/ |
---|
[10719] | 130 | void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
[10678] | 131 | { |
---|
| 132 | SUPER(DivisionController, XMLPort, xmlelement, mode); |
---|
| 133 | |
---|
| 134 | //XMLPortParam(DivisionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f); |
---|
[10719] | 135 | } |
---|
[10678] | 136 | |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | } |
---|