/* * 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: * Gani Aliguzhinov * Co-authors: * Dominik Solenicki * */ #ifndef _FlyingController_H__ #define _FlyingController_H__ #include "controllers/CommonController.h" namespace orxonox { /** @brief FlyingController stores all the flying methods and member variables of AI. */ namespace FormationMode { enum Value { FINGER4, DIAMOND, WALL }; } class _OrxonoxExport FlyingController : public CommonController { public: static const float SPEED = 0.9f/0.02f; static const float ROTATEFACTOR = 0.6f/0.02f; FlyingController(Context* context); virtual ~FlyingController(); virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); void setSpread (int spread) { this->spread_ = spread; } int getSpread () const { return this->spread_; } void setFormationModeXML(std::string val); std::string getFormationModeXML() const; void setFormationMode(FormationMode::Value val) { this->formationMode_ = val; } FormationMode::Value getFormationMode() const { return this->formationMode_; } protected: void stopMoving(); void moveToPosition(const Vector3& target, float dt); void moveToTargetPosition(float dt); void copyOrientation(const Quaternion& orient, float dt); void copyTargetOrientation(float dt); void setTargetPosition(const Vector3& target); void setTargetOrientation(const Quaternion& orient); void setTargetOrientation(ControllableEntity* target); virtual void boostControl(); void keepFormation (const ControllableEntity* leaderEntity, Vector3& targetRelativePosition); FormationMode::Value formationMode_; float rotationProgress_; int actionCounter_; bool bHasTargetPosition_; Vector3 targetPosition_; bool bHasTargetOrientation_; Quaternion targetOrientation_; int spread_; int tolerance_; }; } #endif /* _FlyingController_H__ */