/* * 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: * Oli Scheuss * Co-authors: * Damian 'Mozork' Frick * */ #include "PacmanPointAfraid.h" #include "core/CoreIncludes.h" #include "BulletDynamics/Dynamics/btRigidBody.h" namespace orxonox { RegisterClass(PacmanPointAfraid); /** @brief Constructor. Registers the object and initializes some default values. @param creator The creator of this object. */ PacmanPointAfraid::PacmanPointAfraid(Context* context) : ControllableEntity(context) { RegisterObject(PacmanPointAfraid); this->setCollisionType(CollisionType::None); } /** @brief Destructor. Destroys controller, if present. */ PacmanPointAfraid::~PacmanPointAfraid() { // Deletes the controller if the object was initialized and the pointer to the controller is not NULL. } /** @brief Method for creating a AutonomousDrone through XML. */ void PacmanPointAfraid::XMLPort(Element& xmlelement, XMLPort::Mode mode) { SUPER(PacmanPointAfraid, XMLPort, xmlelement, mode); } void PacmanPointAfraid::tick(float dt) { SUPER(PacmanPointAfraid, tick, dt); } bool PacmanPointAfraid::taken(Vector3 playerpos) { Vector3 resetposition = this->getPosition(); if((abs(resetposition.x - playerpos.x)<1) && (abs(resetposition.z - playerpos.z)<1)){ this->setPosition(Vector3(resetposition.x, -50, resetposition.z)); return true; } return false; } void PacmanPointAfraid::resetPacmanPointAfraid(){ this->setPosition(resetposition); } }