#pragma once #include "core/Common.hpp" #include namespace dnr { class Revolver { public: static constexpr int CHAMBERS_COUNT = 6; Revolver(); void reset(); void setChamber(int index, AmmoType ammo); AmmoType getChamber(int index) const; // Spin cylinder to random chamber void spinToRandom(); void update(float dt); bool isSpinning() const { return m_spinning; } int getCurrentIndex() const { return m_currentIndex; } int getNextIndex() const { return (m_currentIndex + 1) % CHAMBERS_COUNT; } float getVisualAngle() const { return m_visualAngle; } AmmoType getCurrentAmmo() const; AmmoType getNextAmmo() const; // Fire round: empties chamber and steps to next AmmoType fire(); // Advance to next chamber without firing (for multi-shot burst) void advance(); // Check if cylinder has any usable ammunition bool hasAmmo() const; private: std::array m_chambers; int m_currentIndex = 0; int m_targetIndex = 0; bool m_spinning = false; float m_spinTimer = 0.0f; float m_spinDuration = 1.0f; float m_visualAngle = 0.0f; float m_startAngle = 0.0f; float m_targetAngle = 0.0f; }; } // namespace dnr