2023-02-04 23:44:55 -08:00

58 lines
2.0 KiB
C++

// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "visualnovel/scene/SimpleVNScene.hpp"
#include "scenes/Scene_2.hpp"
#include "prefabs/characters/DeathPrefab.hpp"
#include "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp"
#include "visualnovel/events/characters/VisualNovelTransformItemEvent.hpp"
#include "visualnovel/events/timing/VisualNovelBatchEvent.hpp"
namespace Dawn {
class Scene_1 : public SimpleVNScene {
protected:
DeathPrefab *death;
void vnStage() override {
this->death = DeathPrefab::create(this);
this->death->material->color.a = 0;
}
void onSceneEnded() {
auto scene = new Scene_2(this->game);
game->assetManager.queueSwap(
scene->getRequiredAssets(), this->getRequiredAssets()
);
game->assetManager.syncLoad();
scene->stage();
this->game->sceneCutover(scene);
}
public:
Scene_1(DawnGame *game) : SimpleVNScene(game) {
}
std::vector<Asset*> getRequiredAssets() override {
auto man = &this->game->assetManager;
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
vectorAppend(&assets, DeathPrefab::getRequiredAssets(man));
assets.push_back(man->get<AudioAsset>("audio_test"));
return assets;
}
IVisualNovelEvent * getVNEvent() override {
auto start = new VisualNovelPauseEvent(vnManager, 0.1f);
start
->then(new VisualNovelTextboxEvent(vnManager, this->death->vnCharacter, this->death->emotionHappy, "scene.1.1"))
->then(new VisualNovelFadeCharacterEvent(vnManager, this->death->vnCharacter, true, &easeOutQuad, 1.0f))
// ->then(new VisualNovelCallbackEvent<Scene_1>(vnManager, this, &Scene_1::onSceneEnded))
;
return start;
}
};
}