[11610] | 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 | * Simon Miescher |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | |
---|
| 31 | * |
---|
| 32 | * |
---|
| 33 | *<OFFEN Describe |
---|
| 34 | * |
---|
| 35 | * |
---|
| 36 | |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | #include "../../orxonox/worldentities/pawns/Pawn.h" |
---|
| 41 | #include "../../orxonox/worldentities/WorldEntity.h" |
---|
| 42 | |
---|
| 43 | #include "SpicedAsteroidField.h" |
---|
[11615] | 44 | #include "AsteroidMinable.h" |
---|
[11610] | 45 | |
---|
| 46 | #include <algorithm> |
---|
| 47 | |
---|
| 48 | #include "core/CoreIncludes.h" |
---|
| 49 | #include "core/GameMode.h" |
---|
| 50 | #include "core/XMLPort.h" |
---|
| 51 | #include "core/EventIncludes.h" |
---|
| 52 | #include "network/NetworkFunction.h" |
---|
[11615] | 53 | #include "util/Math.h" |
---|
[11610] | 54 | |
---|
| 55 | // #include "infos/PlayerInfo.h" |
---|
| 56 | // #include "controllers/Controller.h" |
---|
| 57 | // #include "gametypes/Gametype.h" |
---|
| 58 | // #include "graphics/ParticleSpawner.h" |
---|
| 59 | // #include "worldentities/ExplosionChunk.h" |
---|
| 60 | // #include "worldentities/ExplosionPart.h" |
---|
| 61 | |
---|
| 62 | // #include "core/object/ObjectListIterator.h" |
---|
| 63 | // #include "controllers/FormationController.h" |
---|
| 64 | |
---|
[11615] | 65 | |
---|
[11610] | 66 | //#include "../pickup/pickup ..... pickupable |
---|
| 67 | #include "../objects/collisionshapes/SphereCollisionShape.h" |
---|
| 68 | #include "../../orxonox/graphics/Model.h" |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | namespace orxonox |
---|
| 76 | { |
---|
| 77 | RegisterClass(SpicedAsteroidField); |
---|
| 78 | |
---|
| 79 | SpicedAsteroidField::SpicedAsteroidField(Context* context) { |
---|
| 80 | |
---|
| 81 | // Da auch noetig? Wegen set in XML-Code? |
---|
| 82 | RegisterObject(SpicedAsteroidField); |
---|
| 83 | |
---|
| 84 | this->context = context; |
---|
| 85 | this->initialised = false; |
---|
| 86 | |
---|
| 87 | //Noetig, damit nicht sofort zerstoert? |
---|
| 88 | this->setCollisionType(WorldEntity::CollisionType::Dynamic); |
---|
| 89 | |
---|
| 90 | // Old from Pawn |
---|
| 91 | this->registerVariables(); |
---|
| 92 | |
---|
| 93 | orxout() << "AsteroidMining:: Pseudo-Konstruktor passiert!" << endl; |
---|
| 94 | |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | SpicedAsteroidField::~SpicedAsteroidField(){ |
---|
| 98 | |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | void SpicedAsteroidField::create(){ |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | void SpicedAsteroidField::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 109 | { |
---|
| 110 | SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode); |
---|
| 111 | // XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode); |
---|
[11615] | 112 | XMLPortParam(SpicedAsteroidField, "count", setCount, getCount, xmlelement, mode); |
---|
| 113 | XMLPortParam(SpicedAsteroidField, "mDensity", setMineralDensity, getMineralDensity, xmlelement, mode); |
---|
| 114 | XMLPortParam(SpicedAsteroidField, "position", setPosition, getPosition, xmlelement, mode); |
---|
| 115 | XMLPortParam(SpicedAsteroidField, "maxSize", setMaxSize, getMaxSize, xmlelement, mode); |
---|
| 116 | XMLPortParam(SpicedAsteroidField, "minSize", setMinSize, getMinSize, xmlelement, mode); |
---|
| 117 | XMLPortParam(SpicedAsteroidField, "radius", setRadius, getRadius, xmlelement, mode); |
---|
| 118 | XMLPortParam(SpicedAsteroidField, "foggy", setFog, isFoggy, xmlelement, mode); |
---|
[11610] | 119 | |
---|
[11615] | 120 | |
---|
[11610] | 121 | } |
---|
| 122 | |
---|
[11615] | 123 | |
---|
| 124 | |
---|
| 125 | |
---|
[11610] | 126 | void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 127 | { |
---|
| 128 | SUPER(SpicedAsteroidField, XMLEventPort, xmlelement, mode); |
---|
| 129 | |
---|
| 130 | XMLPortEventState(SpicedAsteroidField, BaseObject, "vulnerability", setVulnerable, xmlelement, mode); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | void SpicedAsteroidField::registerVariables() |
---|
| 134 | { |
---|
| 135 | // registerVariable(this->bAlive_, VariableDirection::ToClient); |
---|
| 136 | // registerVariable(this->bVulnerable_, VariableDirection::ToClient); |
---|
| 137 | // registerVariable(this->health_, VariableDirection::ToClient); |
---|
| 138 | // registerVariable(this->maxHealth_, VariableDirection::ToClient); |
---|
| 139 | |
---|
| 140 | registerVariable(this->size, VariableDirection::ToClient); |
---|
| 141 | registerVariable(this->generateSmaller, VariableDirection::ToClient); |
---|
| 142 | |
---|
| 143 | registerVariable(this->initialised, VariableDirection::ToClient); |
---|
| 144 | //registerVariable(this->context, VariableDirection::ToClient); // can't link that since it's a context |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | // float size; |
---|
| 148 | // bool generateSmaller; |
---|
| 149 | // bool initialised; |
---|
| 150 | |
---|
| 151 | // Context* context; |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | void SpicedAsteroidField::tick(float dt) |
---|
| 155 | { |
---|
| 156 | |
---|
| 157 | this->create(); |
---|
| 158 | this->~SpicedAsteroidField(); // seems dangerous. Necessary for efficiency? |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | } |
---|