| 355 | } |
| 356 | |
| 357 | void ScriptActorWrapper::OnUpdateHitbox() |
| 358 | { |
| 359 | if (_onUpdateHitbox == nullptr || _isDead->Get()) { |
| 360 | // Call base implementation if not overriden |
| 361 | ActorBase::OnUpdateHitbox(); |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | asIScriptEngine* engine = _obj->GetEngine(); |
| 366 | asIScriptContext* ctx = engine->RequestContext(); |
| 367 | |
| 368 | ctx->Prepare(_onUpdateHitbox); |
| 369 | ctx->SetObject(_obj); |
| 370 | std::int32_t r = ctx->Execute(); |
| 371 | if (r == asEXECUTION_EXCEPTION) { |
| 372 | LOGE("An exception \"{}\" occurred in \"{}\". Please correct the code and try again.", |
| 373 | ctx->GetExceptionString(), ctx->GetExceptionFunction()->GetDeclaration()); |
| 374 | } |
| 375 | |
| 376 | engine->ReturnContext(ctx); |
| 377 | } |
| 378 | |
| 379 | bool ScriptActorWrapper::OnHandleCollision(std::shared_ptr<ActorBase> other) |
| 380 | { |