Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

action PROTECT works. Look FUCK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.