Magic_Game/core/Transition/EmergeTransition.cpp

32 lines
541 B
C++
Raw Normal View History

2018-04-21 21:24:46 +08:00
#include "..\e2dtransition.h"
2018-09-05 13:33:39 +08:00
#include "..\e2dnode.h"
2017-10-21 19:09:31 +08:00
2018-08-14 00:26:20 +08:00
e2d::EmergeTransition::EmergeTransition(Scene* scene, float duration)
: Transition(scene, duration)
2017-10-21 19:09:31 +08:00
{
}
2018-09-04 22:42:34 +08:00
bool e2d::EmergeTransition::Init(Game * game, Scene * prev)
2018-04-17 11:41:33 +08:00
{
2018-09-04 22:42:34 +08:00
if (Transition::Init(game, prev))
2018-08-02 00:27:45 +08:00
{
2018-09-04 22:42:34 +08:00
out_layer_param_.opacity = 1;
in_layer_param_.opacity = 0;
2018-08-02 00:27:45 +08:00
return true;
}
return false;
2018-04-17 11:41:33 +08:00
}
2018-09-04 22:42:34 +08:00
void e2d::EmergeTransition::Update()
2017-10-21 19:09:31 +08:00
{
2018-09-04 22:42:34 +08:00
Transition::Update();
2018-08-02 00:27:45 +08:00
2018-09-04 22:42:34 +08:00
out_layer_param_.opacity = 1 - delta_;
in_layer_param_.opacity = delta_;
2017-10-21 19:09:31 +08:00
2018-09-04 22:42:34 +08:00
if (delta_ >= 1)
2018-01-30 16:45:38 +08:00
{
2018-09-04 22:42:34 +08:00
this->Stop();
}
}