本文整理汇总了C++中ObjectManager::GetObjectFromID方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectManager::GetObjectFromID方法的具体用法?C++ ObjectManager::GetObjectFromID怎么用?C++ ObjectManager::GetObjectFromID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::GetObjectFromID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanUse
bool ARechargeShields::CanUse(int TargetID, long AbilityID, long SkillID)
{
// Get the skill level
m_SkillLevel = (float) m_Player->PlayerIndex()->RPGInfo.Skills.Skill[SkillID].GetLevel();
m_SkillRank = DetermineSkillRank(AbilityID);
m_AbilityID = AbilityID;
m_SkillID = SkillID;
ObjectManager *om = m_Player->GetObjectManager();
//Skill does not exist.
if(m_SkillRank == -1)
{
return false;
}
// Make sure we are not dead
if (m_Player->ShipIndex()->GetIsIncapacitated())
{
SendError("Can not use this ability while dead!");
return false;
}
// See if we can use this skill
if (TargetID > 0 && m_SkillRank >= 3 && om)
{
Object * Target = om->GetObjectFromID(TargetID); // Get Target
if (Target && Target->ObjectType() != m_TargetType)
{
SendError("Incorrect target type!");
return false;
}
// See if we are in range
if (Target->RangeFrom(m_Player->Position()) > CalculateRange(m_SkillLevel, m_SkillRank))
{
SendError("Out of range!");
return false;
}
if(g_PlayerMgr->GetPlayer(TargetID)->ShipIndex()->GetIsIncapacitated())
{
SendError("Cannot recharge a dead player!");
return false;
}
}
//If we are prospecting we cannot use this skill
if (m_Player->Prospecting())
{
SendError("Cannot use while prospecting.");
return false;
}
//if we are warping we cannot use the skill
if (m_Player->WarpDrive())
{
SendError("Cannot use while in warp.");
return false;
}
return true;
}