50 lines
1018 B
C++
50 lines
1018 B
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "VNEvent.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
void VNEvent::init(VNManager *manager) {
|
|
this->manager = manager;
|
|
}
|
|
|
|
void VNEvent::start(
|
|
IVNEventParent *parent,
|
|
VNEvent *previous
|
|
) {
|
|
this->parent = parent;
|
|
finished = false;
|
|
this->onStart();
|
|
}
|
|
|
|
Scene * VNEvent::getScene() {
|
|
return this->manager->getScene();
|
|
}
|
|
|
|
VNEvent * VNEvent::getNextEvent() {
|
|
return this->doNext;
|
|
}
|
|
|
|
void VNEvent::next() {
|
|
assertNotNull(this->manager, "VNEvent::next: Manager cannot be null");
|
|
assertNotNull(this->parent, "VNEvent::next: Parent cannot be null");
|
|
|
|
this->end();
|
|
auto next = this->getNextEvent();
|
|
this->parent->currentEvent = next;
|
|
if(next != nullptr) next->start(this->parent, this);
|
|
}
|
|
|
|
void VNEvent::end() {
|
|
this->finished = true;
|
|
this->unsubscribeAllEvents();
|
|
this->onEnd();
|
|
|
|
this->eventFinished.invoke();
|
|
}
|
|
|
|
void VNEvent::onStart() {}
|
|
void VNEvent::onEnd() {} |