| 449 | } |
| 450 | |
| 451 | void ScriptActorWrapper::OnHitFloor(float timeMult) |
| 452 | { |
| 453 | if (_onHitFloor == nullptr || _isDead->Get()) { |
| 454 | return; |
| 455 | } |
| 456 | |
| 457 | asIScriptEngine* engine = _obj->GetEngine(); |
| 458 | asIScriptContext* ctx = engine->RequestContext(); |
| 459 | |
| 460 | ctx->Prepare(_onHitFloor); |
| 461 | ctx->SetObject(_obj); |
| 462 | ctx->SetArgFloat(0, timeMult); |
| 463 | std::int32_t r = ctx->Execute(); |
| 464 | if (r == asEXECUTION_EXCEPTION) { |
| 465 | LOGE("An exception \"{}\" occurred in \"{}\". Please correct the code and try again.", |
| 466 | ctx->GetExceptionString(), ctx->GetExceptionFunction()->GetDeclaration()); |
| 467 | } |
| 468 | |
| 469 | engine->ReturnContext(ctx); |
| 470 | } |
| 471 | |
| 472 | void ScriptActorWrapper::OnHitCeiling(float timeMult) |
| 473 | { |