Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2011, 4:09:25 PM (14 years ago)
Author:
willis
Message:

added different Modes, debugging

File:
1 edited

Legend:

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

    r8729 r8953  
    116116        }
    117117
    118         if (this->state_ == SLAVE)
    119         {
     118        if (this->state_ == SLAVE && this->mode_==ATTACK)
     119        {
     120            if (!this->target_)
     121            {
     122               this->searchNewTarget();
     123            }
     124
     125            // shoot
     126            random = rnd(maxrand);
     127            if (!(this->passive_) && random < 75 && (this->target_ && !this->bShooting_))
     128                this->bShooting_ = true;
     129
     130            // stop shooting
     131            random = rnd(maxrand);
     132            if (random < 25 && (this->bShooting_))
     133                this->bShooting_ = false;
    120134
    121135        }
     
    142156                   this->spinInit();
    143157
    144                 // follow a randomly chosen human - a specific Master Action
     158                /*// follow a randomly chosen human - a specific Master Action
    145159                random = rnd(1000.0f);
    146160                if (random < 1)
    147161                   this->followRandomHumanInit();
    148 
     162*/
    149163                 // lose master status (only if less than 4 slaves in formation)
    150164                random = rnd(maxrand);
     
    233247        }
    234248
    235         if (this->state_ == SLAVE)
     249        if (this->state_ == SLAVE && this->mode_!=ATTACK)
    236250        {
    237251
     
    241255        }
    242256
    243          if (this->state_ == FREE)
     257         if (this->state_ == FREE || (this->state_==SLAVE && this->mode_==ATTACK) )
    244258        {
    245259            if (this->target_)
Note: See TracChangeset for help on using the changeset viewer.