| 291 | } |
| 292 | |
| 293 | void Tr2StateMachineState::Stop() |
| 294 | { |
| 295 | if( !m_isActive || m_isFinalizing ) |
| 296 | { |
| 297 | return; |
| 298 | } |
| 299 | if( m_stateMachine ) |
| 300 | { |
| 301 | auto owner = m_stateMachine->GetController() != nullptr ? m_stateMachine->GetController()->GetOwner() : nullptr; |
| 302 | for( auto it = begin( m_actions ); it != end( m_actions ); ++it ) |
| 303 | { |
| 304 | ContinueOnMainThread( [_ = IRootPtr( owner ), action = ITr2ControllerActionPtr( *it ), self = Tr2StateMachineStatePtr( this )]() { |
| 305 | if( self->m_stateMachine && action ) |
| 306 | { |
| 307 | action->Stop( *self->m_stateMachine->GetController() ); |
| 308 | } |
| 309 | } ); |
| 310 | } |
| 311 | if( m_finalizer ) |
| 312 | { |
| 313 | if( !m_finalizer->CanTransition( *m_stateMachine->GetController() ) ) |
| 314 | { |
| 315 | m_isFinalizing = true; |
| 316 | return; |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | m_isActive = false; |
| 321 | } |
| 322 | |
| 323 | IRoot* Tr2StateMachineState::GetStateMachinePtr() const |
| 324 | { |
no test coverage detected