本文整理汇总了C++中Ship::AIKamikaze方法的典型用法代码示例。如果您正苦于以下问题:C++ Ship::AIKamikaze方法的具体用法?C++ Ship::AIKamikaze怎么用?C++ Ship::AIKamikaze使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship::AIKamikaze方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_ship_ai_kamikaze
/*
* Method: AIKamikaze
*
* Crash into the target ship.
*
* > ship:AIKamikaze(target)
*
* Parameters:
*
* target - the <Ship> to destroy
*
* Availability:
*
* alpha 26
*
* Status:
*
* experimental
*/
static int l_ship_ai_kamikaze(lua_State *l)
{
Ship *s = LuaObject<Ship>::GetFromLua(1);
if (s->GetFlightState() == Ship::HYPERSPACE)
return luaL_error(l, "Ship:AIKamikaze() cannot be called on a ship in hyperspace");
Ship *target = LuaObject<Ship>::GetFromLua(2);
s->AIKamikaze(target);
return 0;
}
示例2: l_ship_ai_kamikaze
/*
* Method: AIKamikaze
*
* Crash into the target ship.
*
* > ship:AIKamikaze(target)
*
* Parameters:
*
* target - the <Ship> to destroy
*
* Returns:
* true if the command could be enacted, false otherwise
*
* Availability:
*
* alpha 26
*
* Status:
*
* experimental
*/
static int l_ship_ai_kamikaze(lua_State *l)
{
Ship *s = LuaObject<Ship>::GetFromLua(1);
if (s->GetFlightState() == Ship::HYPERSPACE)
return luaL_error(l, "Ship:AIKamikaze() cannot be called on a ship in hyperspace");
Ship *target = LuaObject<Ship>::GetFromLua(2);
if (target != nullptr) {
s->AIKamikaze(target);
lua_pushboolean(l, true);
} else {
lua_pushboolean(l, false);
}
return 1;
}