| 283 | } |
| 284 | |
| 285 | void ScriptActorWrapper::OnHealthChanged(ActorBase* collider) |
| 286 | { |
| 287 | if (_onHealthChanged == nullptr || _isDead->Get()) { |
| 288 | return; |
| 289 | } |
| 290 | |
| 291 | asIScriptEngine* engine = _obj->GetEngine(); |
| 292 | asIScriptContext* ctx = engine->RequestContext(); |
| 293 | |
| 294 | ctx->Prepare(_onHealthChanged); |
| 295 | ctx->SetObject(_obj); |
| 296 | std::int32_t r = ctx->Execute(); |
| 297 | if (r == asEXECUTION_EXCEPTION) { |
| 298 | LOGE("An exception \"{}\" occurred in \"{}\". Please correct the code and try again.", |
| 299 | ctx->GetExceptionString(), ctx->GetExceptionFunction()->GetDeclaration()); |
| 300 | } |
| 301 | |
| 302 | engine->ReturnContext(ctx); |
| 303 | } |
| 304 | |
| 305 | bool ScriptActorWrapper::OnPerish(ActorBase* collider) |
| 306 | { |