/*
 *   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:
 *      ...
 *   Co-authors:
 *      ...
 *
 */



#ifndef _TowerDefenseField_H__
#define _TowerDefenseField_H__

#include "towerdefense/TowerDefensePrereqs.h"
#include "TowerDefenseTower.h"
 #include "TowerDefenseCenterpoint.h"
#include <string>
#include "graphics/Model.h"
#include "worldentities/MovableEntity.h"

namespace orxonox
{
    enum class TowerDefenseFieldType
    { 
        FREE,
        STREET, 
        START, 
        END,
        OBSTACLE,
        TOWER
    };

    /**
    @brief
    See TowerDefenseReadme.txt for Information.
    @ingroup TowerDefense
    */
    class _TowerDefenseExport TowerDefenseField : public MovableEntity
    {
        public:
            TowerDefenseField(Context* context);
            virtual ~TowerDefenseField() {}
            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
            const bool isFree() const
                { return type_==TowerDefenseFieldType::FREE; }
            virtual void create(char object, char param);
            virtual void setCenterpoint(TowerDefenseCenterpoint* center);
            virtual void upgrade();
            virtual int getUpgrade();
            virtual TowerDefenseFieldType getType();
            virtual void setUpgrade(int upgrade);
            virtual bool canUpgrade();
            virtual void createFree(int orientation);
            virtual void createStart(int orientation);
            virtual void createEnd(int orientation);
            virtual void createStraight(int orientation);
            virtual void createLCurve(int orientation);
            virtual void createRCurve(int orientation);
            virtual void createObstacle(int orientation);
            virtual void createTower(int upgrade);
            virtual int getAngle();            
        private:
            virtual void setAngle(int newAngle);            
            virtual void destroyTower();
            int angle_;
            TowerDefenseFieldType type_;
            Model* modelGround_;
            Model* modelObject_;
            TowerDefenseTower* tower_;
            TowerDefenseCenterpoint* center_;
            int upgrade_;

    };    
}

#endif /* _TowerDefenseField_H__ */
