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


C++ GetTeam函数代码示例

本文整理汇总了C++中GetTeam函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTeam函数的具体用法?C++ GetTeam怎么用?C++ GetTeam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetTeam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

//--------------------------------------------------------------------------------------
// Checks whether the necessary conditions for the execution of a certain manoeuvre are 
// still given
// Param1: Identifies the manoeuvre, for which to check the conditions.
// Returns true if the conditions for the manoeuvre are still fulfilled, false otherwise.
//--------------------------------------------------------------------------------------
bool MultiflagCTFTeamAI::ManoeuvreStillValid(TeamManoeuvreType manoeuvre)
{
	EntityTeam enemyTeam = None;
	if(GetTeam() == TeamRed)
	{
		enemyTeam = TeamBlue;
	}else
	{
		enemyTeam = TeamRed;
	}

	switch(manoeuvre)
	{
	case DefendBaseEntrancesManoeuvre:
		return (m_flagData[GetTeam()].m_state == InBase);
		break;
	case RushBaseAttackManoeuvre:
		return (m_flagData[enemyTeam].m_state == InBase);
		break;
	case CoordinatedBaseAttackManoeuvre:
		return (m_flagData[enemyTeam].m_state == InBase);
		break;
	case DistractionBaseAttackManoeuvre:
		return (m_flagData[enemyTeam].m_state == InBase);
		break;
	case SimpleBaseAttackManoeuvre:
		return (m_flagData[enemyTeam].m_state == InBase);
		break;
	case PickUpDroppedFlagManoeuvre:
		return (m_flagData[enemyTeam].m_state == Dropped);
		break;
	case RunTheFlagHomeManoeuvre:
		return (m_flagData[enemyTeam].m_state == Stolen);
		break;
	case ReturnDroppedFlagManoeuvre:
		return (m_flagData[GetTeam()].m_state == Dropped);
		break;
	case SimpleBaseDefenceManoeuvre:
		return (m_flagData[GetTeam()].m_state == InBase);
		break;
	case ActiveBaseDefenceManoeuvre:
		return (m_flagData[GetTeam()].m_state == InBase);
		break;
	case GuardedFlagCaptureManoeuvre:
		return (m_flagData[enemyTeam].m_state == Stolen);
		break;
	case InterceptFlagCarrierManoeuvre:
		return (m_flagData[GetTeam()].m_state == Stolen);
		break;
	default:
		return TeamAI::ManoeuvreStillValid(manoeuvre);
	}
}
开发者ID:BlurEffect,项目名称:SquadAI,代码行数:59,代码来源:MultiflagCTFTeamAI.cpp

示例2: if

void CObject::HandleSpecialSegment (void)
{
if ((info.nType == OBJ_PLAYER) && (gameData.multiplayer.nLocalPlayer == info.nId)) {
	CSegment*		segP = SEGMENTS + info.nSegment;
	CPlayerData*	playerP = gameData.multiplayer.players + gameData.multiplayer.nLocalPlayer;
	fix				shields, fuel;

   if (gameData.app.nGameMode & GM_CAPTURE)
		 segP->CheckForGoal ();
   else if (gameData.app.nGameMode & GM_HOARD)
		 segP->CheckForHoardGoal ();
	else if (Controls [0].forwardThrustTime || Controls [0].verticalThrustTime || Controls [0].sidewaysThrustTime) {
		gameStates.entropy.nTimeLastMoved = -1;
		if ((gameData.app.nGameMode & GM_ENTROPY) &&
			 ((segP->m_owner < 0) || (segP->m_owner == GetTeam (gameData.multiplayer.nLocalPlayer) + 1))) {
			StopConquerWarning ();
			}
		}
	else if (gameStates.entropy.nTimeLastMoved < 0)
		gameStates.entropy.nTimeLastMoved = 0;

	shields = segP->Damage (playerP->shields + 1);
	if (shields > 0) {
		playerP->shields -= shields;
		MultiSendShields ();
		if (playerP->shields < 0)
			StartPlayerDeathSequence (this);
		else
			segP->ConquerCheck ();
		}
	else {
		StopConquerWarning ();
		fuel = segP->Refuel (INITIAL_ENERGY - playerP->energy);
		if (fuel > 0)
			playerP->energy += fuel;
		shields = segP->Repair (INITIAL_SHIELDS - playerP->shields);
		if (shields > 0) {
			playerP->shields += shields;
			MultiSendShields ();
			}
		if (!segP->m_owner)
			segP->ConquerCheck ();
		}
	}
}
开发者ID:paud,项目名称:d2x-xl,代码行数:45,代码来源:updateobject.cpp

示例3: IMPLEMENT_RMI

//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, ClSetTeam)
{
	if (!params.entityId) // ignore these for now
		return true;

	int oldTeam = GetTeam(params.entityId);
	if (oldTeam==params.teamId)
		return true;

	TEntityTeamIdMap::iterator it=m_entityteams.find(params.entityId);
	if (it!=m_entityteams.end())
		m_entityteams.erase(it);

	IActor *pActor=m_pActorSystem->GetActor(params.entityId);
	bool isplayer=pActor!=0;
	if (isplayer && oldTeam)
	{
		TPlayerTeamIdMap::iterator pit=m_playerteams.find(oldTeam);
		assert(pit!=m_playerteams.end());
		stl::find_and_erase(pit->second, params.entityId);
	}

	if (params.teamId)
	{
		m_entityteams.insert(TEntityTeamIdMap::value_type(params.entityId, params.teamId));
		if (isplayer)
		{
			TPlayerTeamIdMap::iterator pit=m_playerteams.find(params.teamId);
			assert(pit!=m_playerteams.end());
			pit->second.push_back(params.entityId);
		}
	}

	if(isplayer)
	{
		ReconfigureVoiceGroups(params.entityId,oldTeam,params.teamId);

		if (pActor->IsClient())
			m_pRadio->SetTeam(GetTeamName(params.teamId));
	}

	m_pScript->CallMethod( "OnSetTeam", params.entityId, params.teamId);

	return true;
}
开发者ID:nhnam,项目名称:Seasons,代码行数:46,代码来源:GameRulesClientServer.cpp

示例4: PrepareMove

void PulseLaser::PrepareMove()
{
  m_front += m_speed;

  if (m_frame.CheckCollision(m_front, m_back, GetTeam(), GetOwner()))
  {
    m_frame.RemoveProjectile(this);
  }

  m_back += m_speed;

  Size screenSize = DrawWrapper::GetSize();

  if (m_back.x > screenSize.x || m_back.x < 0 || m_back.y > screenSize.y || m_back.y < 0)
  {
    m_frame.RemoveProjectile(this);
  }
}
开发者ID:shinarit,项目名称:wiz,代码行数:18,代码来源:flyerz.cpp

示例5: GameWarning

//------------------------------------------------------------------------
void CGameRules::StoreMigratingPlayer(IActor *pActor)
{
	if (pActor == NULL)
	{
		GameWarning("Invalid data for migrating player");
		return;
	}

	IEntity *pEntity = pActor->GetEntity();
	EntityId id = pEntity->GetId();
	bool registered = false;
	uint16 channelId = pActor->GetChannelId();
	CRY_ASSERT(channelId);
	bool bShouldAdd = true;

	if (bShouldAdd && (!m_hostMigrationCachedEntities.empty()))
	{
		if (!stl::find(m_hostMigrationCachedEntities, pActor->GetEntityId()))
		{
			bShouldAdd = false;
		}
	}

	if (bShouldAdd)
	{
		for (uint32 index = 0; index < m_migratingPlayerMaxCount; ++index)
		{
			if (!m_pMigratingPlayerInfo[index].InUse())
			{
				m_pMigratingPlayerInfo[index].SetData(pEntity->GetName(), id, GetTeam(id), pEntity->GetWorldPos(), pEntity->GetWorldAngles(), pActor->GetHealth());
				m_pMigratingPlayerInfo[index].SetChannelID(channelId);
				registered = true;
				break;
			}
		}
	}

	pEntity->Hide(true);		// Hide the player, they will be unhidden when they rejoin

	if (!registered && bShouldAdd)
	{
		GameWarning("Too many migrating players!");
	}
}
开发者ID:richmondx,项目名称:bare-minimum-cryengine3,代码行数:45,代码来源:GameRulesHostMigration.cpp

示例6: Warning

bool CHL2MP_Player::HandleCommand_JoinTeam( int team )
{
	if ( !GetGlobalTeam( team ) || team == 0 )
	{
		Warning( "HandleCommand_JoinTeam( %d ) - invalid team index.\n", team );
		return false;
	}

	if ( team == TEAM_SPECTATOR )
	{
		// Prevent this is the cvar is set
		if ( !mp_allowspectators.GetInt() )
		{
			ClientPrint( this, HUD_PRINTCENTER, "#Cannot_Be_Spectator" );
			return false;
		}

		if ( /*GetTeamNumber() != TEAM_UNASSIGNED &&*/ !IsDead() ) //DHL - Skillet - Players in deathmatch are unassigned
		{
			m_fNextSuicideTime = gpGlobals->curtime;	// allow the suicide to work

			CommitSuicide();

			// add 1 to frags to balance out the 1 subtracted for killing yourself
			IncrementFragCount( 1 );
			GetTeam()->AddScore( 1 ); //DHL - Skillet - Required to keep the scoreboard headers from getting out of sync
		}

		ChangeTeam( TEAM_SPECTATOR );

		return true;
	}
	else
	{
		StopObserverMode();
		State_Transition(STATE_ACTIVE);
	}

	// Switch their actual team...
	ChangeTeam( team );

	return true;
}
开发者ID:dreckard,项目名称:dhl2,代码行数:43,代码来源:hl2mp_player.cpp

示例7: while

bool Monster::Shot(Game_Manager* gm_, coord_def c, float focus_, int item_num)
{
	if(GetShotStop())
		return false;
	if(GetStop())
		return false;
	if(!GetDelay() && weapon)
	{
		focus_ += weapon->GetFocusBase()+GetFocusSum();
		while(SetDelay(weapon->Shot(gm_, this, GetTeam(), GetPos(), c, focus_)*panalty) < 0)
		{
			SetDelay(0.0f);
			weapon->Reload(); //몬스터는 무한 리로드한다.
		}
		if(GetFocus() < weapon->GetFocusMaxReact())
			UpDownFocus(weapon->GetFocusReact());
		return true;
	}
	return false;
}
开发者ID:seobyeongky,项目名称:gunscape,代码行数:20,代码来源:monster.cpp

示例8: IMPLEMENT_RMI

IMPLEMENT_RMI(CGameRules, ClEnteredGame)
{
	CPlayer *pClientActor = static_cast<CPlayer *>(m_pGameFramework->GetClientActor());

	if (pClientActor)
	{
		IEntity *pClientEntity = pClientActor->GetEntity();
		const EntityId clientEntityId = pClientEntity->GetId();

		if(!gEnv->bServer)
		{
			int status[2];
			status[0] = GetTeam(clientEntityId);
			status[1] = pClientActor->GetSpectatorMode();
			m_pGameplayRecorder->Event(pClientEntity, GameplayEvent(eGE_Connected, 0, 0, (void *)status));
		}
	}

	return true;
}
开发者ID:Oliverreason,项目名称:bare-minimum-cryengine3,代码行数:20,代码来源:GameRulesClientServer.cpp

示例9: GetLocalPlayerIndex

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int C_TF_PlayerResource::GetCountForPlayerClass( int iTeam, int iClass, bool bExcludeLocalPlayer /*=false*/ )
{
	int count = 0;
	int iLocalPlayerIndex = GetLocalPlayerIndex();

	for ( int i = 1 ; i <= MAX_PLAYERS ; i++ )
	{
		if ( bExcludeLocalPlayer && ( i == iLocalPlayerIndex ) )
		{
			continue;
		}

		if ( ( GetTeam( i ) == iTeam ) && ( GetPlayerClass( i ) == iClass ) )
		{
			count++;
		}
	}

	return count;
}
开发者ID:bmk10,项目名称:TF2Classic,代码行数:23,代码来源:c_tf_playerresource.cpp

示例10: Action

bool Shot_net::Action(Game_Manager* gm_)
{
	if(valid)
	{
		if(gm_)
		{
			for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
			{
				if((*it)->isLive() && !(*it)->isNonTarget()  && (*it)->GetTeam() != GetTeam() && (*it)->isCollution())
				{
					if((*it)->collution(GetPos(), 5.0f))
					{
						(*it)->SetNet(net_time);
						(*it)->StateApply("그물",net_time);
						valid = false;
					}
				}
			}
		}


		if(collution(3))
		{
			valid = false;
		}
		else
			Move();


		distance -= const_speed;
		if(distance<0)
			valid = false;
	}


	if(!valid)
	{
		return true;
	}
	return false;
}
开发者ID:seobyeongky,项目名称:gunscape,代码行数:41,代码来源:shot_net.cpp

示例11: CheckTeamEconomics

void BotControl::CheckTeamEconomics (int team)
{
   // this function decides is players on specified team is able to buy primary weapons by calculating players
   // that have not enough money to buy primary (with economics), and if this result higher 80%, player is can't
   // buy primary weapons.

   extern ConVar yb_ecorounds;

   if (!yb_ecorounds.GetBool ())
   {
      m_economicsGood[team] = true;
      return; // don't check economics while economics disable
   }

   int numPoorPlayers = 0;
   int numTeamPlayers = 0;

   // start calculating
   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (m_bots[i] != null && GetTeam (m_bots[i]->GetEntity ()) == team)
      {
         if (m_bots[i]->m_moneyAmount <= g_botBuyEconomyTable[0])
            numPoorPlayers++;

         numTeamPlayers++; // update count of team
      }
   }
   m_economicsGood[team] = true;

   if (numTeamPlayers <= 1)
      return;

   // if 80 percent of team have no enough money to purchase primary weapon
   if ((numTeamPlayers * 80) / 100 <= numPoorPlayers)
      m_economicsGood[team] = false;

   // winner must buy something!
   if (m_lastWinner == team)
      m_economicsGood[team] = true;
}
开发者ID:xurubin,项目名称:yapb,代码行数:41,代码来源:control.cpp

示例12: Vector2D

PlayerBase::PlayerBase(BallTeam* home_team,
                       int       home_region,
                       double    maxSpeed,
                       Vector2D    pos,
                       player_role role):MovingEntity(pos,
                                                      Vector2D(0,0),
                                                      Vector2D(1,0),
                                                      Vector2D(1,1),
                                                      0.3,
                                                      maxSpeed,
                                                      0.5,
                                                      0.5,
                                                      0.2),
                                         m_pTeam(home_team),
                                         m_iHomeRegion(home_region),
                                         m_PlayerRole(role),
                                         m_regulator(NULL)
{
    m_pSteering = new SteeringBehaviors(this, GetTeam()->GetGame()->GetBall());
    m_pSteering->SeparationOn();
}
开发者ID:4ker,项目名称:Basketball_demo,代码行数:21,代码来源:PlayerBase.cpp

示例13: GetTeam

std::vector<TechType> DiscoverCmd::GetAncientTechs(const LiveGame& game) const
{
	// "the cheapest Technology Tile you don't already have". Ignoring discounts. 

	// Get all available unresearched techs.
	std::multimap<int, TechType> map;
	auto& team = GetTeam(game);
	for (auto&& pair : game.GetTechnologies())
		if (!team.GetTechTrack().Has(pair.first))
			map.insert(std::make_pair(Technology::GetMaxCost(pair.first), pair.first));

	std::vector<TechType> techs;
	if (!map.empty())
	{
		auto it = map.begin();
		int cheapest = it->first;
		for (; it->first == cheapest; ++it)
			techs.push_back(it->second);
	}
	return techs;
}
开发者ID:molip,项目名称:Eclipsoid,代码行数:21,代码来源:DiscoverCmd.cpp

示例14: ScoreTableRedraw

void ScoreTableRedraw ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

xOffs = (grdCurCanv->cvBitmap.bmProps.w - 640) / 2;
yOffs = (grdCurCanv->cvBitmap.bmProps.h - 480) / 2;
if (xOffs < 0)
	xOffs = 0;
if (yOffs < 0)
	yOffs = 0;
if (gameData.app.nGameMode & GM_MULTI_COOP) {
	ScoreTableDrawCoop ();
	return;
	}
MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cvFont = MEDIUM3_FONT;
GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE, NULL);
grdCurCanv->cvFont = SMALL_FONT;
MultiGetKillList (sorted);
ScoreTableDrawNames (sorted);
for (i=0; i<gameData.multiplayer.nPlayers; i++) {
	if (gameData.app.nGameMode & GM_TEAM)
		color = GetTeam (sorted [i]);
	else
		color = sorted [i];
	if (!gameData.multiplayer.players [sorted [i]].connected)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (playerColors  [color].r, playerColors  [color].g, playerColors [color].b), 1, 0, 0);
	ScoreTableDrawItem (i, sorted);
	}
ScoreTableDrawDeaths (sorted);
PA_DFX (pa_set_frontbuffer_current ());
GrUpdate (0);
PA_DFX (pa_set_backbuffer_current ());
WIN (DDGRUNLOCK (dd_grd_curcanv));
GrPaletteStepLoad (NULL);
}
开发者ID:paud,项目名称:d2x-xl,代码行数:40,代码来源:highscores.c

示例15: Melee

bool Monster::Melee(Game_Manager* gm_)
{
	if(!GetDamage())
		return false;
	bool ok_ = false;
	if(GetStop())
		return false;
	for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
	{
		if((*it)->isLive() && !(*it)->isNonTarget()  && GetTeam() != (*it)->GetTeam())
		{
			if(GetSize()+(*it)->GetSize()+5.0f > distan_coord(GetPos(), (*it)->GetPos()))
			{
				//if(각도가 맞으면)
				MeleeDamage(gm_,(*it));
				SetDelay(30.0f);
				ok_ = true;
			}
		}
	}
	return ok_;
}
开发者ID:seobyeongky,项目名称:gunscape,代码行数:22,代码来源:monster.cpp


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