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


C++ CClient::AutoWaypointOn方法代码示例

本文整理汇总了C++中CClient::AutoWaypointOn方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::AutoWaypointOn方法的具体用法?C++ CClient::AutoWaypointOn怎么用?C++ CClient::AutoWaypointOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CClient的用法示例。


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

示例1: INDEXENT

void CTF2BuiltObjectEvent::Execute(IBotEventInterface *pEvent)
{
	eEngiBuild type = (eEngiBuild)pEvent->GetInt("object");
	int index = pEvent->GetInt("index");
	edict_t *pBuilding = INDEXENT(index);
	CBot *pBot = CBots::GetBotPointer(m_pActivator);

	CClient *pClient = CClients::Get(m_pActivator);

	if (type == ENGI_TELE)
	{
		CTeamFortress2Mod::TeleporterBuilt(m_pActivator, type, pBuilding);

		if (pClient && pClient->AutoWaypointOn())
		{
			if (CTeamFortress2Mod::IsTeleporterEntrance(pBuilding, CTeamFortress2Mod::GetTeam(m_pActivator)))
				pClient->AutoEventWaypoint(CWaypointTypes::W_FL_TELE_ENTRANCE, 400.0f);
			else
				pClient->AutoEventWaypoint(CWaypointTypes::W_FL_TELE_EXIT, 400.0f);
		}
	}

	if (type == ENGI_SENTRY)
	{
		CTeamFortress2Mod::SentryBuilt(m_pActivator, type, pBuilding);

		if (pClient && pClient->AutoWaypointOn())
		{
			pClient->AutoEventWaypoint(CWaypointTypes::W_FL_SENTRY, 400.0f);
		}
	}

	if (type == ENGI_DISP)
	{
		CTeamFortress2Mod::DispenserBuilt(m_pActivator, type, pBuilding);
	}

	if (pBot && pBot->IsTF())
	{
		((CBotFortress*)pBot)->EngiBuildSuccess((eEngiBuild)pEvent->GetInt("object"), pEvent->GetInt("index"));
	}
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:42,代码来源:bot_events.cpp

示例2: Execute

void CFlagEvent::Execute(IBotEventInterface *pEvent)
{
	// dropped / picked up ID
	int type = pEvent->GetInt("eventtype");
	// player id
	int player = pEvent->GetInt("player");

	edict_t *pPlayer = NULL;
	CBot *pBot = NULL;

	// Crash fix
	if (player)
	{
		pPlayer = INDEXENT(player);
		pBot = CBots::GetBotPointer(pPlayer);
	}

	switch (type)
	{
	case FLAG_PICKUP: // pickup
		if (pBot && pBot->IsTF())
		{
			((CBotTF2*)pBot)->PickedUpFlag();
		}

		if (pPlayer)
		{
			int iTeam = CTeamFortress2Mod::GetTeam(pPlayer);

			if (CTeamFortress2Mod::IsFlagAtDefaultState())
			{
				CClient *pClient;

				pClient = CClients::Get(pPlayer);

				if (pClient && pClient->AutoWaypointOn())
					pClient->AutoEventWaypoint(CWaypointTypes::W_FL_FLAG, 200.0f, false);
			}

			CTeamFortress2Mod::FlagPickedUp(iTeam, pPlayer);

		}


		break;
	case FLAG_CAPTURED: // captured
	{
		IPlayerInfo *p = NULL;

		if (pPlayer)
		{
			p = playerinfomanager->GetPlayerInfo(pPlayer);

			if (p)
			{
				CBroadcastFlagCaptured captured = CBroadcastFlagCaptured(p->GetTeamIndex());
				CBots::BotFunction(&captured);
			}
		}

		if (pBot && pBot->IsTF())
		{
			((CBotTF2*)pBot)->CapturedFlag();
			((CBotTF2*)pBot)->DroppedFlag();
		}

		if (pPlayer)
		{
			int iTeam = CTeamFortress2Mod::GetTeam(pPlayer);
			CTeamFortress2Mod::FlagDropped(iTeam, Vector(0, 0, 0));

			CClient *pClient;

			pClient = CClients::Get(pPlayer);

			if (pClient && pClient->AutoWaypointOn())
				pClient->AutoEventWaypoint(CWaypointTypes::W_FL_CAPPOINT, 200.0f, false);
		}

		CTeamFortress2Mod::ResetFlagStateToDefault();

	}
	break;
	case FLAG_DROPPED: // drop
	{
		IPlayerInfo *p = playerinfomanager->GetPlayerInfo(pPlayer);
		Vector vLoc;

		if (p)
		{
			vLoc = CBotGlobals::EntityOrigin(pPlayer);
			CBroadcastFlagDropped dropped = CBroadcastFlagDropped(p->GetTeamIndex(), vLoc);
			CBots::BotFunction(&dropped);
		}

		if (pBot && pBot->IsTF())
			((CBotTF2*)pBot)->DroppedFlag();


		if (pPlayer)
//.........这里部分代码省略.........
开发者ID:Deathreus,项目名称:AFKBot,代码行数:101,代码来源:bot_events.cpp


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