本文整理汇总了C++中SetTarget函数的典型用法代码示例。如果您正苦于以下问题:C++ SetTarget函数的具体用法?C++ SetTarget怎么用?C++ SetTarget使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetTarget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_ASSERT
BattlePet * BattleData::GetCurrentTarget(BattlePet * attackpet)
{
int side = attackpet->m_attackSide;
CC_ASSERT(side == 0 || side == 1, "Side is wrong");
if (m_bTarget[side] < 0 || m_bTarget[side] > 5)
{
SetTarget(side, -1, true, attackpet);
}
if (m_bTarget[side] == -1)
{
return nullptr;
}
if ( !m_bPets[side][m_bTarget[side]]->IsDead() )
{
return m_bPets[side][m_bTarget[side]];
}
else
{
SetTarget(side, -1, true, attackpet);
if (m_bTarget[side] == -1)
{
return nullptr;
}
return m_bPets[side][m_bTarget[side]];
}
}
示例2: SetTarget
void
SeekerAI::CheckDecoys(double target_distance)
{
// if the assigned target has the burner lit,
// ignore the decoys:
if (orig_target && orig_target->Augmenter()) {
SetTarget(orig_target);
return;
}
if (target &&
target == orig_target &&
orig_target->GetActiveDecoys().size()) {
ListIter<Shot> decoy = orig_target->GetActiveDecoys();
while (++decoy) {
double decoy_distance = Point(decoy->Location() - self->Location()).length();
if (decoy_distance < target_distance) {
if (rand() < 1600) {
SetTarget(decoy.value(), 0);
return;
}
}
}
}
}
示例3: SetTarget
void irtkQtBaseViewer::AddToDisplayedImages(irtkQtImageObject *imageObject, int index) {
irtkImage* newImage = imageObject->GetImage();
currentIndex = index;
// If first image to be displayed make it target
if (_image.size() == 0) {
SetTarget(newImage);
InitializeOrigin();
InitializeDimensions();
InitializeOrientation();
}
else if (index < _image.begin()->first) {
SetTarget(newImage);
UpdateCurrentSlice();
InitializeDimensions();
InitializeOrientation();
CalculateOutputImages();
/// check whether image dimensions agree
}
// If everything is fine add to maps
AddToMaps(newImage, index);
_lookupTable.insert(pair<int, irtkQtLookupTable*> ( index, imageObject->GetLookupTable() ));
}
示例4: SetTarget
void Queen::Update(float _deltaTime)
{
BaseAnt::Update(_deltaTime);
if (timeToBorn == QUEEN_TIME_TO_BORN)
{
Log::Message("Was born");
if (strategy != NULL) delete strategy;
SetTarget(NULL);
targetPoint = NULL;
strategy = new WaitingStrategy(this);
wait = true;
}
if (timeToBorn > 0)
{
timeToBorn -= _deltaTime;
}
else if (wait)
{
Log::Message("Want born");
if (strategy != NULL) delete strategy;
SetTarget(NULL);
*targetPoint = *nest->Position();
strategy = new BornStrategy(this);
wait = false;
}
}
示例5: SetTarget
void C_Camera::SpecTargetByIndex(int index)
{
if (index > gpGlobals->maxClients)
{
if (GetMatchBall() && GetMatchBall()->entindex() == index)
SetTarget(index);
}
else
{
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( index );
if (pPlayer)
SetTarget(index);
}
}
示例6: switch
void CNPC_Hydra::StartTask( const Task_t *pTask )
{
switch( pTask->iTask )
{
case TASK_HYDRA_DEPLOY:
m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * 100;
m_idealLength = 100;
m_vecHeadDir = m_vecOutward;
return;
case TASK_HYDRA_PREP_STAB:
{
m_flTaskEndTime = gpGlobals->curtime + pTask->flTaskData;
// Go outward
m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * 100;
SetTarget( (CBaseEntity *)UTIL_GetLocalPlayer() );
if (GetEnemy())
{
SetTarget( GetEnemy() );
}
//CPASAttenuationFilter filter( this, "NPC_Hydra.Alert" );
//Vector vecHead = EyePosition();
//EmitSound( filter, entindex(), "NPC_Hydra.Alert", &vecHead );
}
return;
case TASK_HYDRA_STAB:
{
//CPASAttenuationFilter filter( this, "NPC_Hydra.Attack" );
//Vector vecHead = EyePosition();
//EmitSound( filter, entindex(), "NPC_Hydra.Attack", &vecHead );
m_flTaskEndTime = gpGlobals->curtime + 0.5;
}
return;
case TASK_HYDRA_PULLBACK:
m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * pTask->flTaskData;
m_idealLength = pTask->flTaskData * 1.1;
return;
default:
BaseClass::StartTask( pTask );
break;
}
}
示例7: while
void ZObserver::ChangeToNextTarget()
{
if (g_pGame == NULL) return;
if (m_pTargetCharacter == NULL) return;
ZCharacterManager::iterator itor = g_pGame->m_CharacterManager.find(m_pTargetCharacter->GetUID());
ZCharacter* pCharacter = NULL;
bool bFlag = false;
if (itor != g_pGame->m_CharacterManager.end())
{
do
{
itor++;
if (itor == g_pGame->m_CharacterManager.end())
{
if (bFlag)
{
// This bugs replays when both players die at the same time
//Show(false);
return;
}
itor = g_pGame->m_CharacterManager.begin();
bFlag = true;
}
pCharacter = (*itor).second;
} while (!IsVisibleSetTarget(pCharacter));
SetTarget(pCharacter);
}
}
示例8: SetTarget
void CAI_LeadBehavior::BeginScheduleSelection()
{
SetTarget( AI_GetSinglePlayer() );
CAI_Expresser *pExpresser = GetOuter()->GetExpresser();
if ( pExpresser )
pExpresser->ClearSpokeConcept( TLK_LEAD_ARRIVAL );
}
示例9: autonomous
task autonomous()
{
wait1Msec(5000);
startTask(FlywheelController);
SetTarget(1600,80);
startTask(recoverFromShots);
wait1Msec(4500);
SensorValue[ANGLE] = 0;
clearTimer(T3);
while(time1[T3] <2550)
{
motor[rdy] = motor[rd] = -127 - (SensorValue[ANGLE]); // was 8
motor[ld] = motor[ldy] = -127 + (SensorValue[ANGLE]);
wait1Msec(10);
}
motor[rd] = motor[rdy] = 0;
motor[ld] = motor[ldy] = 0;
startTask(autoConveyor);
while(true)
{}
// AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
示例10: targetMsg
void psClientCharManager::HandleTargetUpdate( MsgEntry* me )
{
psGUITargetUpdateMessage targetMsg(me);
if(targetMsg.targetID.IsValid()) //we have an eid
{
GEMClientObject* object = cel->FindObject( targetMsg.targetID );
if ( object )
SetTarget( object, "select", false);
else
Error1("Received TagetUpdateMessage with invalid target.");
}
else //we have an invalid eid (0) so we untarget
{
SetTarget(NULL, "select", false);
}
}
示例11: SetTarget
FatZombie::~FatZombie()
{
SetTarget(nullptr);
UnregisterFromEvent("GAME_OVER");
}
示例12: LogError
void PetAI::Attack(long actID, long x, long y, CMoveShape *target)
{
if(m_Host == NULL)
{
LogError(AI_MODULE, "m_Host is null.");
return;
}
if (target == NULL)
{
LogError(AI_MODULE, "target is null.");
return;
}
stModuParam *currentSkill = m_Owner->GetInstanceSkill();
if(currentSkill != NULL)
{
eAddSub skillType = currentSkill->GetAddSub();
if(BeginSkill(currentSkill, x, y, target) &&
skillType == eSub_Type)
{
if(target != NULL && target != GetTarget())
{
SetTarget(target->GetExID(), target->GetType());
}
}
}
else
{
LogError(AI_MODULE, "m_Owner->GetInstanceSkill() error");
}
}
示例13: istr
int Reaching::PerformPerturbedTrajectory(string *infname, string *outfname){
string line;
int i,perturbationTime,n=1;
cart_vec_t& tar;
joint_vec_t& pos,acc;
ifstream istr(infname->c_str());
string fname(*outfname);
if(istr.fail()){
cout <<"can't open file "<<infname->c_str()<<endl;
return 0;
}
else{
getline(istr,line);
if(7 != sscanf(line.c_str(),"%f %f %f : %f %f %f %f ",&(tar[0]),&(tar[1]),&(tar[2]),
&(pos[0]),&(pos[1]),&(pos[2]),&(pos[3]))){
#ifndef SILENT
cout << "line " << n << " not decripted"<<endl;
#endif
return -3;
}
else{
if(SetTarget(tar)){
if(SetActualRobPosition(pos)){
ofstream out(fname.c_str());
while(!istr.eof()){
n++;
getline(istr,line);
if(5!= sscanf(line.c_str(),"%d : %f %f %f %f",&perturbationTime,
&(acc[0]),&(acc[1]), &(acc[2]),&(acc[3]))){
#ifndef SILENT
cout << "line " << n << " not decripted"<<endl;
#endif
}
else{
for(i=1;i<perturbationTime;i++){
ReachingStep();
out << *this << endl;
}
SetRobAcceleration(acc);
out << *this << endl;
}
}
for(i=0;i<MAX_IT && !TargetReached();i++){
ReachingStep();
out << *this << endl;
}
out.close();
return TargetReached();
}
else{
return -1;
}
}
else{
return -2;
}
}
}
}
示例14: GetTargetCharacter
bool ZObserver::OnKeyEvent(bool bCtrl, char nKey)
{
int nIndex = 0;
if (m_QuickTarget.ConvertKeyToIndex(nKey, &nIndex) == false)
return false;
if (bCtrl) {
m_QuickTarget.StoreTarget(nIndex, GetTargetCharacter()->GetUID());
} else {
MUID uidTarget = m_QuickTarget.GetTarget(nIndex);
// Å°ÅÁöÁ¤ Ư¼öÅ° »ç¿ë üũ
if ((uidTarget == MUID(0,0)) && (nKey == OBSERVER_QUICK_TAGGER_TARGET_KEY))
{
for (ZCharacterManager::iterator itor = g_pGame->m_CharacterManager.begin();
itor != g_pGame->m_CharacterManager.end(); ++itor)
{
ZCharacter* pChar = (*itor).second;
if (pChar->IsTagger())
{
uidTarget = pChar->GetUID();
break;
}
}
}
ZCharacter* pCharacter = g_pGame->m_CharacterManager.Find(uidTarget);
if (pCharacter && pCharacter->IsDie() == false)
{
SetTarget(uidTarget);
}
}
return true;
}
示例15: SetTarget
void CASW_Rocket::FindHomingPosition( Vector *pTarget )
{
CBaseEntity *pHomingTarget = m_hHomingTarget.Get();
if ( !pHomingTarget )
{
SetTarget( pHomingTarget = FindPotentialTarget() );
m_bFlyingWild = false;
}
if ( pHomingTarget )
{
*pTarget = pHomingTarget->WorldSpaceCenter();
return;
}
else
{
// just fly straight if there's nothing to home in on
Vector vecDir = GetAbsVelocity();
vecDir.z = 0;
*pTarget = GetAbsOrigin() + vecDir * 200.0f;
VectorAngles( vecDir, m_vWobbleAngles );
m_bFlyingWild = true;
}
}