示例#1
0
void LuaAiState::onSeeEnemy(IActor *enemy)
{
    LuaType::registerConstant<IBody>(this->script, "body", this->body);

    LuaFunction luaFunction;
    luaFunction.readyToRunFunction(this->script, "OnSeeEnemy");

    this->script->sendToLua<void*>(enemy);

    luaFunction.runFunction(1, 0);
    luaFunction.clearAfterFunction();

    this->script->removeSymbol("body");
}
示例#2
0
void LuaAiState::onTakeDamage(IActor* instigator, float damageValue, Vector2D impulse)
{
    LuaType::registerConstant<IBody>(this->script, "body", this->body);

    LuaFunction luaFunction;
    luaFunction.readyToRunFunction(this->script, "OnTakeDamage");

    this->script->sendToLua<void*>(instigator);
    this->script->sendToLua<double>(damageValue);

    luaFunction.runFunction(2, 0);
    luaFunction.clearAfterFunction();

    this->script->removeSymbol("body");
}