simplify
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
Transition::Transition()
|
Transition::Transition()
|
||||||
{
|
{
|
||||||
m_State = waiting;
|
m_State = waiting;
|
||||||
m_fSecsIntoTransition = 0.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transition::Load( CString sBGAniDir )
|
void Transition::Load( CString sBGAniDir )
|
||||||
@@ -22,7 +21,6 @@ void Transition::Load( CString sBGAniDir )
|
|||||||
m_fLengthSeconds = m_BGAnimation.GetTweenTimeLeft();
|
m_fLengthSeconds = m_BGAnimation.GetTweenTimeLeft();
|
||||||
|
|
||||||
m_State = waiting;
|
m_State = waiting;
|
||||||
m_fSecsIntoTransition = 0.0f;
|
|
||||||
|
|
||||||
// load sound from file specified by ini, or use the first sound in the directory
|
// load sound from file specified by ini, or use the first sound in the directory
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
@@ -45,30 +43,23 @@ void Transition::Load( CString sBGAniDir )
|
|||||||
|
|
||||||
void Transition::Update( float fDeltaTime )
|
void Transition::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
|
if( m_State != transitioning )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Start the transition on the first update, not in the ctor, so
|
||||||
|
* we don't play a sound while our parent is still loading. */
|
||||||
|
if( m_bFirstUpdate )
|
||||||
|
m_sound.PlayRandom();
|
||||||
|
|
||||||
Actor::Update( fDeltaTime );
|
Actor::Update( fDeltaTime );
|
||||||
|
|
||||||
if( m_State == transitioning )
|
if( m_BGAnimation.GetTweenTimeLeft() == 0 ) // over
|
||||||
{
|
{
|
||||||
/* Start the transition on the first update, not in the ctor, so
|
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
||||||
* we don't play a sound while our parent is still loading. */
|
m_State = finished;
|
||||||
if( m_fSecsIntoTransition==0 ) // first update
|
|
||||||
{
|
|
||||||
m_sound.PlayRandom();
|
|
||||||
|
|
||||||
// stop the sound from playing multiple times on an Update(0)
|
|
||||||
m_fSecsIntoTransition+=0.000001f;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_BGAnimation.Update( fDeltaTime );
|
|
||||||
if( m_fSecsIntoTransition > m_fLengthSeconds ) // over
|
|
||||||
{
|
|
||||||
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
|
||||||
m_fSecsIntoTransition = 0.0;
|
|
||||||
m_State = finished;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_fSecsIntoTransition += fDeltaTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_BGAnimation.Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Transition::EarlyAbortDraw()
|
bool Transition::EarlyAbortDraw()
|
||||||
@@ -88,7 +79,6 @@ void Transition::StartTransitioning( ScreenMessage send_when_done )
|
|||||||
|
|
||||||
m_MessageToSendWhenDone = send_when_done;
|
m_MessageToSendWhenDone = send_when_done;
|
||||||
m_State = transitioning;
|
m_State = transitioning;
|
||||||
m_fSecsIntoTransition = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Transition::GetLengthSeconds() const
|
float Transition::GetLengthSeconds() const
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ protected:
|
|||||||
transitioning,
|
transitioning,
|
||||||
finished
|
finished
|
||||||
} m_State;
|
} m_State;
|
||||||
float m_fSecsIntoTransition;
|
|
||||||
|
|
||||||
|
|
||||||
BGAnimation m_BGAnimation;
|
BGAnimation m_BGAnimation;
|
||||||
float m_fLengthSeconds;
|
float m_fLengthSeconds;
|
||||||
|
|||||||
Reference in New Issue
Block a user