Files
Leviathan/Client/Game/game/Main/Scene/SGameSceneSeqPlayer.cpp
T
2026-06-01 12:46:52 +02:00

67 lines
1.3 KiB
C++

#include "stdafx.h"
#include "SGameSceneSeqPlayer.h"
#include "SGameSceneManager.h"
using namespace rp;
SGameSceneSeqPlayer::SGameSceneSeqPlayer(
SGameSceneManager& sceneMgr
, SGameScene* parent
, const char* sceneName )
: SGameSceneGroup ( sceneMgr, parent, sceneName )
, mCurrentSceneIndex( 0 )
{
}
SGameSceneSeqPlayer::~SGameSceneSeqPlayer()
{
}
void SGameSceneSeqPlayer::onActivate()
{
mCurrentSceneIndex = 0;
if( !isEmpty() )
getChildByIndex( mCurrentSceneIndex )->activate( true );
}
void SGameSceneSeqPlayer::onDeactivate()
{
SGameScene* Scene = getChildByIndex( mCurrentSceneIndex );
if( Scene && Scene->isActivated() )
Scene->activate( false );
}
void SGameSceneSeqPlayer::onTick()
{
if( isEmpty() )
return;
SGameScene* Scene = getChildByIndex( mCurrentSceneIndex );
if( !Scene->isActivated() )
{
mCurrentSceneIndex++;
if( mCurrentSceneIndex >= getSize() )
{
activate( false );
return;
}
Scene = getChildByIndex( mCurrentSceneIndex );
Scene->activate( true );
}
SGameScene::onTick();
updateVisibility();
Scene->onTick();
}
void SGameSceneSeqPlayer::onRender( KViewportObject* viewport )
{
if( isEmpty() )
return;
SGameScene* Scene = getChildByIndex( mCurrentSceneIndex );
if( Scene && Scene->isActivated() && Scene->isVisible() )
Scene->onRender( viewport );
}