本文整理汇总了C++中Map::AddDynamicCell方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::AddDynamicCell方法的具体用法?C++ Map::AddDynamicCell怎么用?C++ Map::AddDynamicCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::AddDynamicCell方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBoxDestroy
void MemeSingleGameType::OnBoxDestroy(uint32 x, uint32 y, bool by_bomb)
{
BillboardDisplayListRecord* templ = BillboardDisplayListRecord::Create(31, 0, 0, 0, 0.8f, 0.8f, true, true);
sParticleEmitterMgr->AddEmitter(templ, x-0.5f, 0.0f, y-0.5f, 0.6f, 0.6f, 90.0f, 0.0f, 0, 0, 150, 30, 5.0f, 0.1f, 10, 5, 0, 0, 0, 1500);
if (by_bomb)
{
// vytvorit bonus na dynamic mape
Map* pMap = (Map*)sMapManager->GetMap();
if (!pMap)
return;
// sance 1:1, pozdeji asi doladit
if (rand()%2 > 0)
{
uint32 which = rand()%3;
pMap->AddDynamicCell(x,y,DYNAMIC_TYPE_BONUS,0,which);
sMapManager->FillDynamicRecords();
}
}
sGameplayMgr->localPlayerStats.MemeSingleStats.boxesDestroyed += 1;
}
示例2: OnGameInit
void MemeSingleGameType::OnGameInit(ModelDisplayListRecord* pPlayerRec)
{
Map* pMap = (Map*)sMapManager->GetMap();
if (!pMap)
return;
m_enemies.clear();
pMap->DestroyAllDynamicRecords();
uint32 startlocpos = 0; // vzdy je jedna vyhrazena pro hrace + se inkrementuje s poctem nepratel
for (uint32 i = 0; i < pMap->field.size(); i++)
{
for (uint32 j = 0; j < pMap->field[0].size(); j++)
{
// Muzeme dat bednu jen na misto kde nebude stat hrac, ani pevny objekt mapy
if (pMap->field[i][j].type == TYPE_GROUND && !pMap->NearStartPos(i,j))
{
// pri 10ti se deli dvema, pri 1 se deli 11ti, asi nejjednodussi
if ((rand()%(12-sGameplayMgr->GetSetting(SETTING_BOX_DENSITY))) == 0)
{
pMap->AddDynamicCell(i,j,DYNAMIC_TYPE_BOX);
}
}
}
}
sMapManager->FillDynamicRecords();
// Pole vsech moznych modelu nepratel
uint32 EnemyModelMap[] = {11};
uint32 count = sizeof(EnemyModelMap)/sizeof(uint32);
uint32 enemycount = 0;
for (uint32 i = 0; i < pMap->field.size(); i++)
{
for (uint32 j = 0; j < pMap->field[0].size(); j++)
{
if (pMap->field[i][j].type == TYPE_STARTLOC)
{
// Pokud je vetsi nez 0, muzeme tam dat nepritele, jinak se jedna o hracovu pozici
if (startlocpos > 0 && startlocpos <= sGameplayMgr->GetSetting(SETTING_ENEMY_COUNT))
{
// TODO: lepsi vyber modelu a tak.. asi to bude lepsi presunout do funkce
// TODO2: vyber AI urovne podle zvolene v nastaveni.. asi derivovat podtridu, ale je to fuk, de to zapodminkovat
EnemyTemplate* pEnemy = new EnemyTemplate;
pEnemy->Init(EnemyModelMap[(rand()%count)], i, j, ++enemycount);
pEnemy->m_movement->SetSpeedMod(1.0f - (float(sGameplayMgr->GetSetting(SETTING_ENEMY_SPEED)) / 10.0f));
pEnemy->m_movement->Mutate(MOVEMENT_TARGETTED);
m_enemies.push_back(pEnemy);
startlocpos++;
}
else
{
pPlayerRec->x = i-0.5f;
pPlayerRec->z = j-0.5f;
startlocpos++;
}
}
}
}
}