本文整理汇总了C++中setCurrentVictim函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentVictim函数的具体用法?C++ setCurrentVictim怎么用?C++ setCurrentVictim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCurrentVictim函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent)
{
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
HostileReference* hostileReference = threatRefStatusChangeEvent->getReference();
switch (threatRefStatusChangeEvent->getType())
{
case UEV_THREAT_REF_THREAT_CHANGE:
if ((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
(getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue() > 0.0f))
{
setDirty(true); // the order in the threat list might have changed
}
break;
case UEV_THREAT_REF_ONLINE_STATUS:
if (!hostileReference->isOnline())
{
if (hostileReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
iThreatContainer.remove(hostileReference);
iThreatOfflineContainer.addReference(hostileReference);
}
else
{
if (getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
{
setDirty(true);
}
iThreatContainer.addReference(hostileReference);
iThreatOfflineContainer.remove(hostileReference);
}
break;
case UEV_THREAT_REF_REMOVE_FROM_LIST:
if (hostileReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
if (hostileReference->isOnline())
{
iThreatContainer.remove(hostileReference);
}
else
{
iThreatOfflineContainer.remove(hostileReference);
}
break;
}
}
开发者ID:43094361,项目名称:server,代码行数:53,代码来源:ThreatManager.cpp
示例2: switch
bool ThreatManager::processThreatEvent(const UnitBaseEvent* pUnitBaseEvent)
{
bool consumed = false;
ThreatRefStatusChangeEvent* threatRefStatusChangeEvent;
HostilReference* hostilReference;
threatRefStatusChangeEvent = (ThreatRefStatusChangeEvent*) pUnitBaseEvent;
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
hostilReference = threatRefStatusChangeEvent->getReference();
switch(pUnitBaseEvent->getType())
{
case UEV_THREAT_REF_THREAT_CHANGE:
if((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
(getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f))
setDirty(true); // the order in the threat list might have changed
break;
case UEV_THREAT_REF_ONLINE_STATUS:
if(!hostilReference->isOnline())
{
if (hostilReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
iThreatContainer.remove(hostilReference);
iThreatOfflineContainer.addReference(hostilReference);
}
else
{
if(getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
setDirty(true);
iThreatContainer.addReference(hostilReference);
iThreatOfflineContainer.remove(hostilReference);
}
break;
case UEV_THREAT_REF_REMOVE_FROM_LIST:
if (hostilReference == getCurrentVictim())
{
setCurrentVictim(NULL);
setDirty(true);
}
if(hostilReference->isOnline())
iThreatContainer.remove(hostilReference);
else
iThreatOfflineContainer.remove(hostilReference);
break;
}
return consumed;
}
开发者ID:de-dima,项目名称:243,代码行数:51,代码来源:ThreatManager.cpp
示例3: getOwner
Unit* ThreatManager::getHostileTarget()
{
iThreatContainer.update();
HostileReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim());
setCurrentVictim(nextVictim);
return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr;
}
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:7,代码来源:ThreatManager.cpp
示例4: getCurrentVictim
Unit* ThreatManager::getHostilTarget()
{
iThreatContainer.update();
HostileReference* nextVictim = iThreatContainer.selectNextVictim(getOwner()->ToCreature(), getCurrentVictim());
setCurrentVictim(nextVictim);
return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL;
}
开发者ID:hallabro,项目名称:hallabro-trinity,代码行数:7,代码来源:ThreatManager.cpp
示例5: HostileReference
void ThreatManager::_addThreat(Unit* victim, float threat)
{
HostileReference* ref = iThreatContainer.addThreat(victim, threat);
// Ref is not in the online refs, search the offline refs next
if (!ref)
ref = iThreatOfflineContainer.addThreat(victim, threat);
if (!ref) // there was no ref => create a new one
{
bool isFirst = iThreatContainer.empty();
// threat has to be 0 here
HostileReference* hostileRef = new HostileReference(victim, this, 0);
iThreatContainer.addReference(hostileRef);
hostileRef->addThreat(threat); // now we add the real threat
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster())
hostileRef->setOnlineOfflineState(false); // GM is always offline
else if (isFirst)
setCurrentVictim(hostileRef);
}
}
开发者ID:martial69320,项目名称:cerberus,代码行数:20,代码来源:ThreatManager.cpp
示例6: setCurrentVictim
void ThreatManager::setCurrentVictimByTarget(Unit* target)
{
if (HostileReference* ref = iThreatContainer.getReferenceByTarget(target))
setCurrentVictim(ref);
}
开发者ID:killerwife,项目名称:mangos-tbc,代码行数:5,代码来源:ThreatManager.cpp
注:本文中的setCurrentVictim函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论