本文整理汇总了C++中CCharacter::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GetType方法的具体用法?C++ CCharacter::GetType怎么用?C++ CCharacter::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CharacterTakeDamage
int CLuaFile::CharacterTakeDamage(lua_State *L)
{
lua_getglobal(L, "pLUA");
CLuaFile *pSelf = (CLuaFile *)lua_touserdata(L, -1);
lua_Debug Frame;
lua_getstack(L, 1, &Frame);
lua_getinfo(L, "nlSf", &Frame);
if (!lua_isnumber(L, 1))
return 0;
CCharacter *pChr = (CCharacter *)pSelf->m_pServer->m_World.GetEntityByID(lua_tointeger(L, 1));
if (pChr && pChr->GetType() == CGameWorld::ENTTYPE_CHARACTER)
{
int Dmg = 1;
int From = -1;
int Weapon = -1;
if (lua_isnumber(L, 2))
Dmg = lua_tonumber(L, 2);
if (lua_isnumber(L, 3))
From = lua_tonumber(L, 3);
if (lua_isnumber(L, 4))
Weapon = lua_tonumber(L, 4);
pChr->TakeDamage(vec2(0, 0), Dmg, From, Weapon);
}
return 0;
}
示例2: CharacterGetArmor
int CLuaFile::CharacterGetArmor(lua_State *L)
{
lua_getglobal(L, "pLUA");
CLuaFile *pSelf = (CLuaFile *)lua_touserdata(L, -1);
lua_Debug Frame;
lua_getstack(L, 1, &Frame);
lua_getinfo(L, "nlSf", &Frame);
if (!lua_isnumber(L, 1))
return 0;
CCharacter *pChr = (CCharacter *)pSelf->m_pServer->m_World.GetEntityByID(lua_tointeger(L, 1));
if (pChr && pChr->GetType() == CGameWorld::ENTTYPE_CHARACTER)
{
lua_pushinteger(L, pChr->GetHealth());
return 1;
}
return 0;
}