/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Manuel Meier * Co-authors: * Cyrill Burgener * */ /** @file OrxoKart.cc @brief Implementation of the OrxoKart class. Sets up the whole Minigame */ #include "OrxoKart.h" #include "OrxoKartFlag.h" #include "OrxoKartKart.h" #include "OrxoKartOrigin.h" #include "OrxoKartTile.h" #include "core/CoreIncludes.h" namespace orxonox { RegisterUnloadableClass(OrxoKart); OrxoKart::OrxoKart(Context* context) : Gametype(context) { RegisterObject(OrxoKart); this->origin_ = nullptr; this->numberOfFlags_ = 1; this->firstTick_ = true; this->setHUDTemplate("OrxoKartHUD"); } void OrxoKart::tick(float dt) { SUPER(OrxoKart, tick, dt); if(this->firstTick_ && this->origin_) { this->firstTick_ = false; int n = this->origin_->getNumCells(); int s = this->origin_->getCellSize(); int map_1[] = {1,1,1,1,1,1,1,1,0,0,0 ,1,0,0,0,0,0,0,1,1,1,0 ,1,0,1,1,1,1,0,0,0,1,1 ,1,1,1,0,0,1,1,0,0,0,1 ,0,0,0,0,0,0,1,0,1,1,1 ,1,1,1,1,1,1,1,0,1,0,0 ,1,0,0,0,0,0,0,0,1,0,0 ,1,0,0,0,0,0,0,0,1,0,0 ,1,1,1,1,1,0,0,0,1,1,1 ,0,0,0,0,1,0,0,0,0,0,1 ,0,0,0,0,1,1,1,2,1,1,1}; int map_2[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,1, 0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1, 0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,1, 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,2,1,1,1,0,1,1,1}; int *levelcodeArray = map_2; //Generate floor according to levelcode for(int i=0; igetContext()))->init((n-1-i)*s, j*s, s, type); } } //bottom flag OrxoKartFlag* flag = new OrxoKartFlag(origin_->getContext()); flag->init(n, s); flag_ = flag; }//firsttick end // Check if ship collided with the flag if(flag_->getCollided()){ OrxoKartKart* player = flag_->getObjectofCollision(); orxout() << "Orientation= " << player->getOrientation() << endl; player->setPosition(Vector3(80*0, 40, 80*18)); player->setOrientation(Quaternion(1, 0, 0, 0)); // 0, 0, 0 player->setVelocity(Vector3(0,0,0)); player->setAcceleration(Vector3(0,0,0)); flag_->setCollided(false); // flag_->destroyLater(); // flags_.erase (flags_.begin()+i); numberOfFlags_ = 0; } } }