/* * 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: * Fabian 'x3n' Landau * Co-authors: * ... * */ #ifndef _FightingController_H__ #define _FightingController_H__ #include "controllers/FlyingController.h" namespace orxonox { class _OrxonoxExport FightingController : public FlyingController { public: FightingController(Context* context); virtual ~FightingController(); virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); float squaredDistanceToTarget() const; bool isLookingAtTarget(float angle); bool hasTarget(); ControllableEntity* getTarget() { return this->target_; } protected: void setTarget(ControllableEntity* target); void setPositionOfTarget(const Vector3& target); void setOrientationOfTarget(const Quaternion& orient); void stopLookingAtTarget(); void startLookingAtTarget(); void lookAtTarget(float dt); void maneuver(); void dodge(Vector3& thisPosition, Vector3& diffUnit); bool canFire(); void doFire(); WeakPtr target_; void setClosestTarget(); bool bHasPositionOfTarget_; Vector3 positionOfTarget_; bool bHasOrientationOfTarget_; Quaternion orientationOfTarget_; Pawn* closestTarget(); int attackRange_; bool bShooting_; int maneuverCounter_; bool bLookAtTarget_; }; } #endif /* _FightingController_H__ */