/********************\ | Copyright 2024, | | Ulysse Cura | \********************/ //////////////////////////////////////////////////// // // // Composant interactif, ici pour les serrures. // // // //////////////////////////////////////////////////// #ifndef LOCK_HPP #define LOCK_HPP #include "AnimationSystem.hpp" #include "InteractableComponent.hpp" #include "../Game.hpp" class Lock : public InteractableComponent { public: Lock(int channel) : m_channel(channel) {} void init() override { m_animation = &entity->getComponent(); m_animation->loop = false; } void update() override { if(!m_animation->playAnimation && m_lockInteracted) { Game::entityManager.getChannelManager().setChannel(m_channel, true); } } void interact() override { if(!m_animation->playAnimation && !m_lockInteracted) { m_animation->playAnimation = true; m_lockInteracted = true; } } private: int m_channel; AnimationSystem *m_animation; bool m_lockInteracted {false}; }; #endif