feat(title): destell hiperespacial al VP quan la nau desapareix (sparkle 4-puntes còncau)
This commit is contained in:
@@ -142,9 +142,14 @@ namespace Title {
|
||||
case ShipState::FLOATING:
|
||||
updateFloating(ship, delta_time);
|
||||
break;
|
||||
case ShipState::EXITING:
|
||||
case ShipState::EXITING: {
|
||||
updateExiting(ship, delta_time);
|
||||
// Transició a invisible: la nau acaba d'arribar al VP.
|
||||
if (!ship.visible && on_ship_disappear_) {
|
||||
on_ship_disappear_(ship.player_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
#include "core/graphics/camera3d.hpp"
|
||||
#include "core/graphics/wireframe3d.hpp"
|
||||
@@ -70,10 +71,16 @@ namespace Title {
|
||||
[[nodiscard]] auto isAnimationComplete() const -> bool;
|
||||
[[nodiscard]] auto isVisible() const -> bool;
|
||||
|
||||
// Callback disparat quan una nau acaba l'EXITING (es torna invisible
|
||||
// al VP). Útil per a un destell que tapi el pop final.
|
||||
using ShipDisappearCallback = std::function<void(int player_id)>;
|
||||
void setOnShipDisappear(ShipDisappearCallback cb) { on_ship_disappear_ = std::move(cb); }
|
||||
|
||||
private:
|
||||
Rendering::Renderer* renderer_;
|
||||
const Graphics::Camera3D* camera_;
|
||||
std::array<TitleShip, 2> ships_;
|
||||
ShipDisappearCallback on_ship_disappear_;
|
||||
|
||||
static void updateEntering(TitleShip& ship, float delta_time);
|
||||
static void updateFloating(TitleShip& ship, float delta_time);
|
||||
|
||||
Reference in New Issue
Block a user