本文整理汇总了C++中SoccerWorld::setAITeam方法的典型用法代码示例。如果您正苦于以下问题:C++ SoccerWorld::setAITeam方法的具体用法?C++ SoccerWorld::setAITeam怎么用?C++ SoccerWorld::setAITeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoccerWorld
的用法示例。
在下文中一共展示了SoccerWorld::setAITeam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/** This function is called after instanciating. The code here can't be moved
* to the contructor as child classes must be instanciated, otherwise
* polymorphism will fail and the results will be incorrect . Also in init()
* functions can be called that use World::getWorld().
*/
void World::init()
{
m_faster_music_active = false;
m_fastest_kart = 0;
m_eliminated_karts = 0;
m_eliminated_players = 0;
m_num_players = 0;
unsigned int gk = 0;
if (race_manager->hasGhostKarts())
gk = ReplayPlay::get()->getNumGhostKart();
// Create the race gui before anything else is attached to the scene node
// (which happens when the track is loaded). This allows the race gui to
// do any rendering on texture. Note that this function can NOT be called
// in the World constuctor, since it might be overwritten by a the game
// mode class, which would not have been constructed at the time that this
// constructor is called, so the wrong race gui would be created.
createRaceGUI();
RewindManager::create();
// Grab the track file
Track *track = track_manager->getTrack(race_manager->getTrackName());
Scripting::ScriptEngine::getInstance<Scripting::ScriptEngine>();
if(!track)
{
std::ostringstream msg;
msg << "Track '" << race_manager->getTrackName()
<< "' not found.\n";
throw std::runtime_error(msg.str());
}
std::string script_path = track->getTrackFile("scripting.as");
Scripting::ScriptEngine::getInstance()->loadScript(script_path, true);
// Create the physics
Physics::getInstance<Physics>();
unsigned int num_karts = race_manager->getNumberOfKarts();
//assert(num_karts > 0);
// Load the track models - this must be done before the karts so that the
// karts can be positioned properly on (and not in) the tracks.
// This also defines the static Track::getCurrentTrack function.
track->loadTrackModel(race_manager->getReverseTrack());
if (gk > 0)
{
ReplayPlay::get()->load();
for (unsigned int k = 0; k < gk; k++)
m_karts.push_back(ReplayPlay::get()->getGhostKart(k));
}
// Assign team of AIs for soccer mode before createKart
SoccerWorld* sw = dynamic_cast<SoccerWorld*>(this);
if (sw)
sw->setAITeam();
for(unsigned int i=0; i<num_karts; i++)
{
if (race_manager->getKartType(i) == RaceManager::KT_GHOST) continue;
std::string kart_ident = history->replayHistory()
? history->getKartIdent(i)
: race_manager->getKartIdent(i);
int local_player_id = race_manager->getKartLocalPlayerId(i);
int global_player_id = race_manager->getKartGlobalPlayerId(i);
AbstractKart* newkart = createKart(kart_ident, i, local_player_id,
global_player_id,
race_manager->getKartType(i),
race_manager->getPlayerDifficulty(i));
m_karts.push_back(newkart);
track->adjustForFog(newkart->getNode());
} // for i
// Load other custom models if needed
loadCustomModels();
#ifndef SERVER_ONLY
// Now that all models are loaded, apply the overrides
irr_driver->applyObjectPassShader();
#endif
// Must be called after all karts are created
m_race_gui->init();
powerup_manager->updateWeightsForRace(race_manager->getNumberOfKarts());
if (UserConfigParams::m_weather_effects)
{
Weather::getInstance<Weather>(); // create Weather instance
}
} // init