本文整理汇总了C++中CMobEntity::SetDespawnTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CMobEntity::SetDespawnTime方法的具体用法?C++ CMobEntity::SetDespawnTime怎么用?C++ CMobEntity::SetDespawnTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMobEntity
的用法示例。
在下文中一共展示了CMobEntity::SetDespawnTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WeatherChange
void CZoneEntities::WeatherChange(WEATHER weather)
{
auto element = zoneutils::GetWeatherElement(weather);
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PCurrentMob = (CMobEntity*)it->second;
PCurrentMob->PAI->EventHandler.triggerListener("WEATHER_CHANGE", PCurrentMob, static_cast<int>(weather), element);
// can't detect by scent in this weather
if (PCurrentMob->m_Aggro & AGGRO_SCENT)
{
PCurrentMob->m_disableScent = (weather == WEATHER_RAIN || weather == WEATHER_SQUALL || weather == WEATHER_BLIZZARDS);
}
if (PCurrentMob->m_EcoSystem == SYSTEM_ELEMENTAL && PCurrentMob->PMaster == nullptr && PCurrentMob->m_SpawnType == SPAWNTYPE_WEATHER)
{
if (PCurrentMob->m_Element == element)
{
PCurrentMob->SetDespawnTime(0s);
PCurrentMob->m_AllowRespawn = true;
PCurrentMob->Spawn();
}
else
{
PCurrentMob->SetDespawnTime(1s);
PCurrentMob->m_AllowRespawn = false;
}
}
else if (PCurrentMob->m_SpawnType == SPAWNTYPE_FOG)
{
if (weather == WEATHER_FOG)
{
PCurrentMob->SetDespawnTime(0s);
PCurrentMob->m_AllowRespawn = true;
PCurrentMob->Spawn();
}
else
{
PCurrentMob->SetDespawnTime(1s);
PCurrentMob->m_AllowRespawn = false;
}
}
}
for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it)
{
CCharEntity* PChar = (CCharEntity*)it->second;
PChar->PLatentEffectContainer->CheckLatentsZone();
PChar->PAI->EventHandler.triggerListener("WEATHER_CHANGE", PChar, static_cast<int>(weather), element);
}
}
示例2: TOTDChange
void CZoneEntities::TOTDChange(TIMETYPE TOTD)
{
SCRIPTTYPE ScriptType = SCRIPT_NONE;
switch (TOTD)
{
case TIME_MIDNIGHT:
{
}
break;
case TIME_NEWDAY:
{
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PMob = (CMobEntity*)it->second;
if (PMob->m_SpawnType == SPAWNTYPE_ATNIGHT)
{
PMob->SetDespawnTime(1ms);
PMob->m_AllowRespawn = false;
}
}
}
break;
case TIME_DAWN:
{
ScriptType = SCRIPT_TIME_DAWN;
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PMob = (CMobEntity*)it->second;
if (PMob->m_SpawnType == SPAWNTYPE_ATEVENING)
{
PMob->SetDespawnTime(1ms);
PMob->m_AllowRespawn = false;
}
}
}
break;
case TIME_DAY:
{
ScriptType = SCRIPT_TIME_DAY;
}
break;
case TIME_DUSK:
{
ScriptType = SCRIPT_TIME_DUSK;
}
break;
case TIME_EVENING:
{
ScriptType = SCRIPT_TIME_EVENING;
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PMob = (CMobEntity*)it->second;
if (PMob->m_SpawnType == SPAWNTYPE_ATEVENING)
{
PMob->SetDespawnTime(0s);
PMob->m_AllowRespawn = true;
PMob->Spawn();
}
}
}
break;
case TIME_NIGHT:
{
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PMob = (CMobEntity*)it->second;
if (PMob->m_SpawnType == SPAWNTYPE_ATNIGHT)
{
PMob->SetDespawnTime(0s);
PMob->m_AllowRespawn = true;
PMob->Spawn();
}
}
}
break;
}
if (ScriptType != SCRIPT_NONE)
{
for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it)
{
charutils::CheckEquipLogic((CCharEntity*)it->second, ScriptType, TOTD);
}
}
}