Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 24, 2015, 10:37:28 PM (8 years ago)
Author:
gania
Message:

works for the most part, still need to fix Section and Wingman

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.h

    r10849 r10851  
    3939#include "tools/interfaces/Tickable.h"
    4040#include <limits>
     41#include <algorithm>
    4142#include "worldentities/Actionpoint.h"
    4243
     
    9091            virtual void tick(float dt);
    9192
    92             //----[XML data]----
     93            //----[XML methods]----
    9394                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    94                 //----[Action data]----
    95                     Action::Value getAction ();
    96                     void setAction (Action::Value action);
    97                     void setAction (Action::Value action, ControllableEntity* target);
    98                     void setAction (Action::Value action, const Vector3& target);
    99                     void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
    100                     void setActionXML( std::string val);
    101                     std::string getActionXML();
    102                 //----[/Action data]----
    103                 //----[Formation data]----
    104                     virtual void setFormationModeXML(std::string val);
    105                     virtual std::string getFormationModeXML();
    106                     virtual void setFormationMode(FormationMode::Value val)
    107                         { this->formationMode_ = val; }
    108                     inline FormationMode::Value getFormationMode() const
    109                         { return this->formationMode_; }
    110                 //----[/Formation data]----
    111                 //----[Rank data]----
    112                     virtual void setRank(Rank::Value val)
    113                         { this->rank_ = val; }
    114                     inline Rank::Value getRank() const
    115                         { return this->rank_; }
    116                 //----[/Rank data]----
    117                 //----[Protect data]----
    118                     void setProtectXML( std::string val );
    119                     std::string getProtectXML ();
    120                     void setProtect (ControllableEntity* protect);
    121                     ControllableEntity* getProtect ();
    122                 //----[/Protect data]----
    123                 //----[Actionpoint data]----
     95               
     96                    void setFormationModeXML(std::string val);
     97                    std::string getFormationModeXML();
     98                    void setFormationMode(FormationMode::Value val);
     99                    FormationMode::Value getFormationMode() const;
     100
     101                    void setRank(Rank::Value val);
     102                    Rank::Value getRank() const;
     103               
    124104                    void addActionpoint(WorldEntity* waypoint);
    125105                    WorldEntity* getActionpoint(unsigned int index) const;
    126                 //----[/Actionpoint data]----
    127             //----[/XML data]----
     106            //----[/XML methods]----
    128107
    129108            //----[Interaction with other Controllers]----
    130109                virtual bool setWingman(CommonController* wingman);
    131110                virtual bool hasWingman();       
    132 
    133                 void setPositionOfTarget(const Vector3& target);
    134                 void setOrientationOfTarget(const Quaternion& orient);
    135 
    136                 void setTarget(ControllableEntity* target);
     111               
     112                bool hasTarget();
    137113                ControllableEntity* getTarget();
    138                 bool hasTarget();
    139 
    140                 void setTargetPosition(const Vector3& target);
    141                 void setTargetOrientation(const Quaternion& orient);
    142                 void setTargetOrientation(ControllableEntity* target);
     114                     
     115                Action::Value getAction ();
     116                std::string getActionName();
     117
     118                void setAction (Action::Value action);
     119                void setAction (Action::Value action, ControllableEntity* target);
     120                void setAction (Action::Value action, const Vector3& target);
     121                void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
    143122            //----[/Interaction with other Controllers]----
    144123
    145             //----[Helper functions]----
     124            //----[Helper methods]----
    146125                float randomInRange(float a, float b);
    147126                static float distance(ControllableEntity* entity1, ControllableEntity* entity2);
     
    151130
    152131                float squaredDistanceToTarget() const;
    153                 bool isLookingAtTarget(float angle) const;
    154             //----[/Helper functions]----
    155 
     132                bool isLookingAtTarget(float angle);
     133            //----[/Helper methods]----
     134
     135             //----[Actionpoint information]----
     136
     137                std::vector<WeakPtr<WorldEntity> > actionpoints_;
     138                float squaredaccuracy_;
     139                std::vector<Point > parsedActionpoints_;
     140
     141            //----[/Actionpoint information]----
     142                //----[Actionpoint methods]----
     143                void executeActionpoint();
     144                void nextActionpoint();
     145            //----[Actionpoint methods]----
    156146        protected:
    157             //----[Flying functionality]----
     147            //----[Flying methods]----
    158148                void stopMoving();
    159 
    160                 void moveToPoint(const Vector3& relativeTargetPosition, float angleRoll);
    161                 bool moveAndRoll(float dt);
     149                void stopLookingAtTarget();
     150                void startLookingAtTarget();
    162151
    163152                void moveToPosition(const Vector3& target, float dt);
     
    168157
    169158                void lookAtTarget(float dt);
    170                 void stopLookingAtTarget();
    171                 void startLookingAtTarget();
    172 
    173                 bool bLookAtTarget_;       
    174             //----[/Flying functionality]----
     159
     160                void setTargetPosition(const Vector3& target);
     161                void setTargetOrientation(const Quaternion& orient);
     162                void setTargetOrientation(ControllableEntity* target);
     163
     164
     165            //----[/Flying methods]----
    175166           
    176             //----[Fighting functionality]----
     167            //----[Fighting methods]----
     168                void setTarget(ControllableEntity* target);
     169
     170                void setPositionOfTarget(const Vector3& target);
     171                void setOrientationOfTarget(const Quaternion& orient);
     172
     173                void setProtect (ControllableEntity* protect);
     174                ControllableEntity* getProtect ();
     175
    177176                void maneuver();
    178177                void dodge(Vector3& thisPosition, Vector3& diffUnit);
    179                 void aimAtTarget();           
    180178                bool canFire();
    181179                void doFire();
    182180                void setClosestTarget();
    183181                Pawn* closestTarget();
    184 
    185                 bool bShooting_;
    186                 int maneuverCounter_;         
    187             //----[/Fighting functionality]----           
     182                bool startAttackingEnemiesThatAreClose();
     183            //----[/Fighting methods]----           
    188184           
    189185            //----[where-to-fly information]----
     186               
    190187                bool bHasTargetPosition_;
    191188                Vector3 targetPosition_;
     
    193190                Quaternion targetOrientation_;
    194191               
    195                
    196192            //----[/where-to-fly information]----
    197193            //----[protect information]----
     
    207203            //----[/who-to-kill information]----
    208204
    209             //----[Actionpoint information]----
    210                 std::vector<WeakPtr<WorldEntity> > actionpoints_;
    211                 float squaredaccuracy_;
    212                 Point  currentActionpoint_;
    213                 std::vector<Point > parsedActionpoints_;
    214                 void executeActionpoint();
    215                 void nextActionpoint();
    216             //----[/Actionpoint information]----
     205           
    217206            //----["Private" variables]----
    218207                FormationMode::Value formationMode_;
     
    222211                Action::Value action_;
    223212                int attackRange_;
    224                
     213                bool bLookAtTarget_;       
     214                bool bShooting_;
     215                int maneuverCounter_;
     216                int tolerance_;
     217                bool bFirstTick_;                       
    225218            //----[/"Private" variables]----               
    226219    };
Note: See TracChangeset for help on using the changeset viewer.