| 334 | } |
| 335 | |
| 336 | void ScriptActorWrapper::OnUpdate(float timeMult) |
| 337 | { |
| 338 | if (_onUpdate == nullptr || _isDead->Get()) { |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | asIScriptEngine* engine = _obj->GetEngine(); |
| 343 | asIScriptContext* ctx = engine->RequestContext(); |
| 344 | |
| 345 | ctx->Prepare(_onUpdate); |
| 346 | ctx->SetObject(_obj); |
| 347 | ctx->SetArgFloat(0, timeMult); |
| 348 | std::int32_t r = ctx->Execute(); |
| 349 | if (r == asEXECUTION_EXCEPTION) { |
| 350 | LOGE("An exception \"{}\" occurred in \"{}\". Please correct the code and try again.", |
| 351 | ctx->GetExceptionString(), ctx->GetExceptionFunction()->GetDeclaration()); |
| 352 | } |
| 353 | |
| 354 | engine->ReturnContext(ctx); |
| 355 | } |
| 356 | |
| 357 | void ScriptActorWrapper::OnUpdateHitbox() |
| 358 | { |