当前位置: 首页>>代码示例>>C++>>正文


C++ SetTarget函数代码示例

本文整理汇总了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]];
	}

}
开发者ID:LeoYangLing,项目名称:Client,代码行数:29,代码来源:BattleData.cpp

示例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;
                }
            }
        }
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:28,代码来源:SeekerAI.cpp

示例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() ));
}
开发者ID:ghisvail,项目名称:M3diView,代码行数:25,代码来源:irtkQtBaseViewer.cpp

示例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;
	}
}
开发者ID:michaelilyin,项目名称:Anthill,代码行数:26,代码来源:Queen.cpp

示例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);
	}
}
开发者ID:rain2372,项目名称:IOS-1,代码行数:14,代码来源:ios_camera.cpp

示例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;
	}

}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:48,代码来源:npc_hydra.cpp

示例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);
	}
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:33,代码来源:ZObserver.cpp

示例8: SetTarget

void CAI_LeadBehavior::BeginScheduleSelection()
{
	SetTarget( AI_GetSinglePlayer() );
	CAI_Expresser *pExpresser = GetOuter()->GetExpresser();
	if ( pExpresser )
		pExpresser->ClearSpokeConcept( TLK_LEAD_ARRIVAL );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:7,代码来源:ai_behavior_lead.cpp

示例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.
}
开发者ID:apoorvk,项目名称:Exothermic-Zen-NBN-Robot-Code,代码行数:25,代码来源:State.c

示例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);
    }
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:16,代码来源:psclientchar.cpp

示例11: SetTarget

FatZombie::~FatZombie()
{
	SetTarget(nullptr);
	UnregisterFromEvent("GAME_OVER");

	
}
开发者ID:CMcLaine92,项目名称:Zombie-Strike,代码行数:7,代码来源:FatZombie.cpp

示例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");
		}
    }
开发者ID:Caoxuyang,项目名称:klcommon,代码行数:30,代码来源:PetAI.cpp

示例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;
      }
    }
  }
}
开发者ID:pattacini,项目名称:iros2010,代码行数:60,代码来源:ReachingGen.cpp

示例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;
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:34,代码来源:ZObserver.cpp

示例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;
	}
}
开发者ID:docfinorlias,项目名称:asb2,代码行数:25,代码来源:asw_rocket.cpp


注:本文中的SetTarget函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。