Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 22, 2011, 6:57:16 PM (14 years ago)
Author:
jo
Message:

Bots are ready for rocket usage. (The hit rate for rockets is just about 60% though.). Note that this is just a proof of concept implementation. The next goal is a more generic implementation that adjusts the AI to any spaceship, not only the assff and similar ones.

File:
1 edited

Legend:

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

    r8701 r8711  
    270270            }
    271271        }//END_OF DEFAULT MODE
    272         else if (this->mode_ == ROCKET)
     272        else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant.
    273273        {   
    274274            ControllableEntity *controllable = this->getControllableEntity();
    275275            if(controllable)
    276276            {
    277                  if(controllable->getRocket())//Check wether the bot is controlling the rocket.
    278                  {
    279                      this->follow(); //TODO: CHECK: does follow make the bot crash into the target_ ?
    280                  }
    281                  else
    282                      this->mode_ = DEFAULT;//no rocket -> get out of rocket mode
     277                if(controllable->getRocket())//Check wether the bot is controlling the rocket and if the timeout is over.
     278                {
     279                    this->follow(); //TODO: CHECK: does follow make the bot crash into the target_ ?
     280                    this->timeout_ -= dt;
     281                    if((timeout_< 0)||(!target_))//Check if the timeout is over or target died.
     282                    {
     283                       controllable->fire(0);//kill the rocket
     284                       this->setPreviousMode();//get out of rocket mode
     285                    }
     286                }
     287                else
     288                    this->setPreviousMode();//no rocket entity -> get out of rocket mode
    283289            }
    284290            else
    285                 this->mode_ = DEFAULT;//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode
     291                this->setPreviousMode();//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode
    286292        }//END_OF ROCKET MODE
    287293        SUPER(AIController, tick, dt);
Note: See TracChangeset for help on using the changeset viewer.