2021-11-23 13:35:13 -05:00
|
|
|
#include "mockclassicnote.h"
|
2021-12-27 13:41:25 -05:00
|
|
|
#include "graphics/classicgraphicsmanager.h"
|
2021-12-28 13:04:50 -05:00
|
|
|
#include "graphics/animations/classicanimationscenario.h"
|
2021-11-23 13:35:13 -05:00
|
|
|
|
|
|
|
MockClassicNote::MockClassicNote(MockArrowNoteInitializer&& init) :
|
2021-12-28 13:04:50 -05:00
|
|
|
ClassicNote({nullptr, {}, init.initializer.perfect_offset}),
|
2021-11-24 13:21:30 -05:00
|
|
|
_state(State::NONE),
|
|
|
|
_context(init.initializer.context)
|
|
|
|
{
|
|
|
|
_elements.resize(init.elements.size());
|
|
|
|
|
|
|
|
for (std::size_t i = 0; i < _elements.size(); ++i)
|
|
|
|
{
|
|
|
|
_elements[i].coordinates = init.elements[i].coordinates;
|
|
|
|
_elements[i].type = init.elements[i].type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 12:33:24 -05:00
|
|
|
void MockClassicNote::putToGame()
|
2021-11-24 13:21:30 -05:00
|
|
|
{
|
2021-12-23 12:33:24 -05:00
|
|
|
_state = State::FLYING;
|
2021-11-24 13:21:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void MockClassicNote::update(const microsec &music_offset)
|
|
|
|
{
|
|
|
|
switch (_state)
|
|
|
|
{
|
|
|
|
default: return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case State::FLYING:
|
|
|
|
if (music_offset > offset())
|
|
|
|
_state = State::DEAD;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto& element : _elements)
|
|
|
|
if (element.animations[_state])
|
|
|
|
element.animations[_state]->update(music_offset);
|
|
|
|
}
|
|
|
|
|