Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2011, 11:40:54 PM (14 years ago)
Author:
jo
Message:

First successful attempt, to make bots shoot rockets. Unfortunately they're shooting the wrong ones.

File:
1 edited

Legend:

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

    r8239 r8701  
    8888        this->numberOfWeapons = 0;
    8989        this->botlevel_ = 1.0f;
     90        this->mode_ = DEFAULT;
    9091    }
    9192
     
    10341035        else if(this->getControllableEntity()&&(numberOfWeapons>0)&&this->bShooting_ && this->isCloseAtTarget((1 + 2*botlevel_)*1000) && this->isLookingAtTarget(math::pi / 20.0f))
    10351036        {
    1036             if (this->isCloseAtTarget(130) && this->isLookingAtTarget(math::pi / 20.0f)&&(weapons[1]==1) )
     1037            /*if (this->isCloseAtTarget(130) && this->isLookingAtTarget(math::pi / 20.0f)&&(weapons[1]==1) )
     1038            {//LENSFLARE: short range weapon     
    10371039                this->getControllableEntity()->fire(1); //ai uses lens flare if they're close enough to the target
    1038 
    1039           //default fire (laser)
    1040           else if ((weapons[0]==0))
    1041                this->getControllableEntity()->fire(0);
     1040            }
     1041            else if(this->isLookingAtTarget(math::pi / 20.0f)&&(weapons[3]==3)&& this->isCloseAtTarget(260) &&projectiles[3] )*/
     1042            {//ROCKET: mid range weapon
     1043                //TODO: Which weapon is the rocket? How many rockets are available?
     1044                this->mode_ = ROCKET;
     1045                //TODO: this->rockettimer->start()
     1046                this->getControllableEntity()->fire(3);//launch rocket
     1047                this->projectiles[3]-=1;//decrease ammo !!
     1048            }
     1049           
     1050            /*else if ((weapons[0]==0))//LASER: default weapon
     1051                this->getControllableEntity()->fire(0);*/
    10421052        }
    10431053    }
     
    10451055        @brief Information gathering: Which weapons are ready to use?
    10461056    */
    1047     void ArtificialController::setupWeapons()
     1057    void ArtificialController::setupWeapons() //TODO: Make this function generic!! (at the moment is is based on conventions)
    10481058    {
    10491059        if(this->getControllableEntity())
     
    10571067                      {
    10581068                          weapons[i]=i;
     1069                          projectiles[i]=1;//TODO: how to express infinite ammo? how to get data??
    10591070                          numberOfWeapons++;
    10601071                      }
     
    10621073                          weapons[i]=-1;
    10631074                 }
     1075                 //pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
    10641076            }
    10651077        }
     
    10701082    {
    10711083        if (level < 0.0f)
    1072             this->botlevel_ = 0.0f;
    1073         else if (level > 1.0f)
    1074             this->botlevel_ = 1.0f;
    1075         else
     1084            this->botlevel_ = 0.0f;
     1085        else if (level > 1.0f)
     1086            this->botlevel_ = 1.0f;
     1087        else
    10761088            this->botlevel_ = level;
    10771089    }
     
    10841096   
    10851097}
     1098
Note: See TracChangeset for help on using the changeset viewer.