Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10840


Ignore:
Timestamp:
Nov 23, 2015, 4:56:50 PM (8 years ago)
Author:
gania
Message:

action PROTECT works. Look FUCK

Location:
code/branches/campaignHS15
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/data/levels/AITest.oxw

    r10838 r10840  
    6666      </templates>
    6767      <controller>
    68         <WingmanController >
     68        <WingmanController team=0>
    6969        </WingmanController>
    7070      </controller>
     
    7575      </templates>
    7676      <controller>
    77         <WingmanController >
     77        <WingmanController team=0>
    7878        </WingmanController>
    7979      </controller>
     
    8484      </templates>
    8585      <controller>
    86         <SectionController >
     86        <SectionController team=0>
    8787        </SectionController>
    8888      </controller>
     
    9393      </templates>
    9494      <controller>
    95         <SectionController>
     95        <SectionController team=0>
    9696        </SectionController>
    9797      </controller>
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc

    r10838 r10840  
    8080    void CommonController::setProtectXML( std::string val )
    8181    {
    82         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    83         {
    84             if ((*itP)->getName() == val)
    85             {
    86                 this->setProtect (static_cast<ControllableEntity*>(*itP));
    87             }
    88         }
    89     }
     82        this->protectName_ = val;
     83       
     84    }
     85    void CommonController::tick(float dt)
     86    {
     87
     88    }
     89
    9090    std::string CommonController::getProtectXML ()
    9191    {
     
    202202        else if (action == Action::PROTECT)
    203203        {
     204            if (target)
     205                this->setProtect (target);
    204206        }
    205207    }
     
    211213            this->setTargetPosition (target);
    212214        }
    213         else if (action == Action::PROTECT)
    214         {
    215 
    216         }
     215       
    217216    }
    218217    void CommonController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
     
    224223            this->setTargetOrientation (orient);
    225224        }
    226         else if (action == Action::PROTECT)
    227         {
    228            
    229         }
     225       
    230226    }
    231227    void CommonController::setClosestTarget()
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.h

    r10838 r10840  
    7777            CommonController(Context* context);
    7878            virtual ~CommonController();
     79
     80            virtual void tick(float dt);
    7981
    8082            //----[XML data]----
     
    194196                FormationMode::Value formationMode_;
    195197                Rank::Value rank_;
     198                std::string protectName_;
    196199                Action::Value action_;
    197200            //----[/"Private" variables]----               
  • code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc

    r10838 r10840  
    133133        else if (this->action_ == Action::PROTECT)
    134134        {
    135             if (this->getProtect())
    136             {
    137                 orxout(internal_error) << "PROTECT FOUND" << endl;
    138             }
     135            if (!this->getProtect())
     136            {
     137                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     138                {
     139                    if ((*itP)->getName() == this->protectName_)
     140                    {
     141                        this->setProtect (static_cast<ControllableEntity*>(*itP));
     142                    }
     143                }
     144            }
     145            else
     146            {
     147               /* if (this->myWingman_)
     148                    this->myWingman_->setAction (Action::PROTECT, this->getProtect());
     149                if (this->myFollower_)
     150                    this->myFollower_->setAction (Action::PROTECT, this->getProtect());
     151                */
     152                Vector3* targetRelativePosition;
     153                   
     154                targetRelativePosition = new Vector3 (0, 0, 500); 
     155     
     156                Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) +
     157                    (this->getProtect()->getWorldOrientation()* (*targetRelativePosition)));
     158                this->setTargetPosition(targetAbsolutePosition);
     159               
     160                this->setTargetPositionOfWingman();
     161                this->setTargetPositionOfFollower();
     162            }           
     163
    139164        }
    140165
  • code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc

    r10838 r10840  
    145145        else if (this->action_ == Action::PROTECT)
    146146        {
     147           /* if (this->myWingman_)
     148                this->myWingman_->setAction (Action::PROTECT, this->getProtect());
     149*/
     150            this->setTargetPositionOfWingman();
    147151
    148152        }
Note: See TracChangeset for help on using the changeset viewer.