本文整理汇总了C++中GameObject::GetDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::GetDescription方法的具体用法?C++ GameObject::GetDescription怎么用?C++ GameObject::GetDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::GetDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
GuardRoom::Execute( ExamineCommand & cmd )
{
Room & room = *this;
if ( cmd.m_strTarget == "guard")
{
m_numSearches++;
m_numTotalSearches++;
// Three consequtive searches wake guard
if ( m_numSearches >= 3 )
{
// Report death message attached to room
cout << GetProperty("deathmessage").As<string>() << "\n";
g_Game.SetProperty("running", false);
}
else if ( m_numTotalSearches == 4 && g_Game.GetPlayer().GetItems()["key"] == NULL )
{
cout << GetProperty("key_found_message").As<string>() << ". ";
GameObject *pKey = new GameObject();
pKey->SetId("ID_KEY");
pKey->SetName("key");
pKey->SetDescription("key you pick-pocketed from guard");
g_Game.GetPlayer().GetItems().push_back( pKey);
}
else
{
cout << GetProperty("guard_search_msg").As<string>() << ". ";
}
}
else if ( cmd.m_strTarget == "room" )
{
cout << room.GetDescription() << "\n";
list<string> items;
for(auto item : room.GetItems())
{
items.push_back(item->GetName());
}
if ( items.empty())
{
cout << "There seems to be nothing in the room. ";
}
else
{
cout << "You can see " << Game::MakeReadable(items) << " in here.";
}
cout << "\n";
}
else
{
// examining room items.
GameObject * item = GetItems()[cmd.m_strTarget];
if ( item ) cout << item->GetDescription() << ". ";
else cout << "I do not know how to examine " << cmd.m_strTarget << ". ";
cout << "\n";
}
}
示例2: GetItems
void
Player::Execute( ExamineCommand & cmd )
{
GameObject * item = GetItems()[cmd.m_strTarget];
if ( !item ) throw ExamineCommandFailOnPlayerException("");
cout << "After taking a closer look, you see " << item->GetDescription() << ". ";
}