本文整理汇总了C++中Level::GetPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ Level::GetPlayer方法的具体用法?C++ Level::GetPlayer怎么用?C++ Level::GetPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level::GetPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndContact
void Weapon::EndContact(PhysicsActor *actThisPtr, PhysicsActor *actOtherPtr)
{
// We're not interested in the wielder or other actors
if ((actThisPtr != m_HitRegionPtr)
|| ((m_WielderPtr != nullptr) && (m_WielderPtr->GetActor() == actOtherPtr)))
{
return;
}
// Check whether it is the player,
// Else check whether it is an enemy.
Level* level = Singleton<Level>::GetInstance();
if ((level->GetPlayer() != nullptr) && (actOtherPtr == level->GetPlayer()->GetActor()))
{
RemoveTarget(level->GetPlayer());
}
else
{
const std::vector<Enemy*>& enemies = level->GetEnemies();
for (std::vector<Enemy*>::const_iterator it = enemies.cbegin(); it != enemies.cend(); ++it)
{
if ((*it)->GetActor() == actOtherPtr)
{
RemoveTarget(*it);
}
}
}
}
示例2: Update
void Door::Update(Level& level, const sf::Time& timePassed)
{
if(IsActive() && !IsFinished()) {
if(level.GetPlayer().HasKey(doorName)) {
level.SetHUDText("Used " + description + ".");
soundManager.PlaySound("open");
isOpened = true;
Finish();
} else {
level.SetHUDText("Locked; need " + description + ".");
soundManager.PlaySound("locked");
isActive = false;
}
isCollidable = !isOpened && !isBroken;
}
if(isOpened) {
PlayAnim("open", timePassed);
} else if(isBroken) {
PlayAnim("broken", timePassed);
} else {
PlayAnim("idle", timePassed);
}
}