Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2011, 4:56:15 PM (13 years ago)
Author:
jo
Message:

Works. (Seperate/independent states are used to manage the behaviour).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/formation/src/orxonox/controllers/HumanController.cc

    r8990 r8991  
    106106        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
    107107        {
    108             if (HumanController::localController_s->mode_!=ATTACK)
     108            if (HumanController::localController_s->formationMode_ != ATTACK)
    109109                HumanController::localController_s->commandSlaves();
    110110        }
     
    177177            HumanController::localController_s->controllableEntity_->fire(firemode);
    178178            //if human fires, set slaves free. See FormationController::forceFreeSlaves()
    179             if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->mode_==NORMAL)
     179            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
    180180            {
    181181                HumanController::localController_s->forceFreeSlaves();
     
    317317        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
    318318        {
    319             switch (HumanController::localController_s->getMode()) {
     319            switch (HumanController::localController_s->getFormationMode()) {
    320320                case NORMAL:
    321                     HumanController::localController_s->setMode(DEFEND);
     321                    HumanController::localController_s->setFormationMode(DEFEND);
    322322                    orxout(message) <<"Mode: DEFEND "<< endl;
    323323                    break;
    324324                case DEFEND:
    325                     HumanController::localController_s->setMode(ATTACK);
     325                    HumanController::localController_s->setFormationMode(ATTACK);
    326326                    orxout(message) <<"Mode: ATTACK "<< endl;
    327327                    break;
    328328                case ATTACK:
    329                     HumanController::localController_s->setMode(NORMAL);
     329                    HumanController::localController_s->setFormationMode(NORMAL);
    330330                    orxout(message) <<"Mode: NORMAL "<< endl;
    331331                    break;
    332                 default: //catch all non-formation related states
    333                     break;
    334332            }
    335333        }
     
    340338    void HumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    341339    {
    342         if (!this->formationFlight_ || this->state_!=MASTER || this->mode_!=DEFEND) return;
     340        if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
    343341            this->masterAttacked(originator);
    344342    }
Note: See TracChangeset for help on using the changeset viewer.