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


C++ Bot::EntityIsVisible方法代码示例

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


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

示例1: Execute


//.........这里部分代码省略.........
         else if (strcmp (PTR_TO_STR (p), "vipsafety") == 0)
            m_bot->m_inVIPZone = (enabled != 0);
         else if (strcmp (PTR_TO_STR (p), "c4") == 0)
            m_bot->m_inBombZone = (enabled == 2);
         break;
      }
      break;

   case NETMSG_DEATH: // this message sends on death
      switch (m_state)
      {
      case 0:
         killerIndex = PTR_TO_INT (p);
         break;

      case 1:
         victimIndex = PTR_TO_INT (p);
         break;

      case 2:
         if (killerIndex != 0 && killerIndex != victimIndex)
         {
            edict_t *killer = INDEXENT (killerIndex);
            edict_t *victim = INDEXENT (victimIndex);

            if (FNullEnt (killer) || FNullEnt (victim))
               break;

            // need to send congrats on well placed shot
            for (int i = 0; i < engine->GetMaxClients (); i++)
            {
               Bot *bot = g_botManager->GetBot (i);

               if (bot != null && IsAlive (bot->GetEntity ()) && killer != bot->GetEntity () && bot->EntityIsVisible (victim->v.origin) && GetTeam (killer) == GetTeam (bot->GetEntity ()) && GetTeam (killer) != GetTeam (victim))
               {
                  if (killer == g_hostEntity)
                     bot->HandleChatterMessage ("#Bot_NiceShotCommander");
                  else
                     bot->HandleChatterMessage ("#Bot_NiceShotPall");

                  break;
               }
            }
            
            // SyPB Pro P.15
            if (GetGameMod () == 0)
            {
	            // notice nearby to victim teammates, that attacker is near
	            for (int i = 0; i < engine->GetMaxClients (); i++)
	            {
	               Bot *bot = g_botManager->GetBot (i);

	               if (bot != null && IsAlive (bot->GetEntity ()) && GetTeam (bot->GetEntity ()) == GetTeam (victim) && IsVisible (killer->v.origin, bot->GetEntity ()) && FNullEnt (bot->m_enemy) && GetTeam (killer) != GetTeam (victim))
	               {
	                  bot->m_actualReactionTime = 0.0f;
	                  bot->m_seeEnemyTime = engine->GetTime ();
	                  bot->m_enemy = killer;
	                  bot->m_lastEnemy = killer;
	                  bot->m_lastEnemyOrigin = killer->v.origin;
	               }
	            }
	        }

            Bot *bot = g_botManager->GetBot (killer);

            // is this message about a bot who killed somebody?
开发者ID:CCNHsK-Dev,项目名称:SyPB,代码行数:67,代码来源:netmsg.cpp


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