Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 15, 2015, 4:47:35 PM (8 years ago)
Author:
gania
Message:

Finished groundwork: AI fights enemies like I want it to. TODO implement all the functionality of old AI, like Waypoints, XMLPort

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc

    r10789 r10805  
    111111    void WingmanController::tick(float dt)
    112112    {   
    113        
    114        
    115113        if (!this->isActive())
    116114            return;
    117         if (!this->target_)
    118         {
    119             //stay in formation
    120         }
    121         else
    122         {
    123 
    124         }
    125115        if (this->bHasTargetPosition_)
    126116        {
    127117            this->moveToTargetPosition(dt);
    128         }
    129        
    130         if (this->bShooting_)
    131             doFire();
     118        }
     119        else if (this->bLookAtTarget_)
     120        {
     121            this->lookAtTarget(dt);
     122        }
     123        if (bShooting_)
     124        {
     125            this->doFire();
     126        }
    132127       
    133128        SUPER(WingmanController, tick, dt);
     
    144139            else
    145140            {
    146                 //orxout(internal_error) << "0 leader" << endl;
    147                
     141                if (!this->target_){
     142                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     143                    {
     144                        if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
     145                            continue;   
     146                        this->setAction(Action::FIGHT, (*itP));
     147                        break;
     148                    }
     149                }
    148150            }
    149151
     
    153155
    154156        }
    155         if (canFire())
    156            this->bShooting_ = true;
    157         else
    158             this->bShooting_ = false;
     157       
     158        if (this->action_ == Action::FIGHT)
     159        {
     160            this->maneuver();
     161            this->bShooting_ = this->canFire();
     162            if (this->target_)
     163            {
     164                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
     165                if (diffVector.length() > 5000)
     166                {
     167                 
     168                }   
     169            }
     170        }
     171        else if (this->action_ == Action::FLY)
     172        {
     173
     174        }
     175        else if (this->action_ == Action::PROTECT)
     176        {
     177
     178        }
    159179         
    160180    }
Note: See TracChangeset for help on using the changeset viewer.