Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2015, 7:58:44 PM (8 years ago)
Author:
gania
Message:

finished copyOrientation function. Now ships move smoothly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc

    r10877 r10879  
    8383            Action::FIGHTALL && this->myDivisionLeader_->getAction() != Action::ATTACK)
    8484        {
    85             ControllableEntity* myEntity = this->getControllableEntity();
     85           
     86        }   
     87        SUPER(SectionController, tick, dt);
     88    }
     89
     90    void SectionController::action()
     91    {
     92        if (!this || !this->getControllableEntity())
     93            return;
     94
     95        //----If no leader, find one---- 
     96        if (!myDivisionLeader_)
     97        {
     98            LeaderController* newDivisionLeader = findNewDivisionLeader();
     99            this->myDivisionLeader_ = newDivisionLeader;
     100            if (this->myDivisionLeader_)
     101            {
     102
     103            }
     104        }
     105        //----If have leader----
     106        else
     107        {
     108        }
     109        if (!myDivisionLeader_)
     110        {
     111           
     112            ActionpointController::action();
     113            if (!this || !this->getControllableEntity())
     114                return;
     115            if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
     116            {
     117                if (this->myWingman_)
     118                {
     119                    this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
     120                }   
     121            }
     122        }
     123        else if (myDivisionLeader_)
     124        {
     125            switch (myDivisionLeader_->getAction())
     126            {
     127                case Action::FIGHT:
     128                {
     129                    if (!this->hasTarget())
     130                    {
     131                        this->chooseTarget();
     132                    }
     133                    break;
     134                }
     135                case Action::FIGHTALL:
     136                {
     137                    if (!this->hasTarget())
     138                    {
     139                        this->chooseTarget();
     140                    }
     141                    break;
     142                }
     143                case Action::ATTACK:
     144                {
     145                    if (!this->hasTarget())
     146                    {
     147                        this->chooseTarget();
     148                    }
     149                    break;
     150                }
     151                default:
     152                {
     153                    //formation flight is executed in tick
     154                    ControllableEntity* myEntity = this->getControllableEntity();
    86155            Vector3 myPosition = myEntity->getWorldPosition();
    87156            if (!this->myDivisionLeader_)
     
    111180               this->getControllableEntity()->boost(false);
    112181            }
    113         }   
    114         SUPER(SectionController, tick, dt);
    115     }
    116 
    117     void SectionController::action()
    118     {
    119         if (!this || !this->getControllableEntity())
    120             return;
    121 
    122         //----If no leader, find one---- 
    123         if (!myDivisionLeader_)
    124         {
    125             LeaderController* newDivisionLeader = findNewDivisionLeader();
    126             this->myDivisionLeader_ = newDivisionLeader;
    127 
    128         }
    129         //----If have leader----
    130         else
    131         {
    132         }
    133         if (!myDivisionLeader_)
    134         {
    135            
    136             ActionpointController::action();
    137             if (!this || !this->getControllableEntity())
    138                 return;
    139             if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
    140             {
    141                 if (this->myWingman_)
    142                 {
    143                     this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
    144                 }   
    145             }
    146         }
    147         else if (myDivisionLeader_)
    148         {
    149             switch (myDivisionLeader_->getAction())
    150             {
    151                 case Action::FIGHT:
    152                 {
    153                     if (!this->hasTarget())
    154                     {
    155                         this->chooseTarget();
    156                     }
    157                     break;
    158                 }
    159                 case Action::FIGHTALL:
    160                 {
    161                     if (!this->hasTarget())
    162                     {
    163                         this->chooseTarget();
    164                     }
    165                     break;
    166                 }
    167                 case Action::ATTACK:
    168                 {
    169                     if (!this->hasTarget())
    170                     {
    171                         this->chooseTarget();
    172                     }
    173                     break;
    174                 }
    175                 default:
    176                 {
    177                     //formation flight is executed in tick
    178182                }
    179183            }
Note: See TracChangeset for help on using the changeset viewer.