| 109 | } |
| 110 | |
| 111 | void ContainerObject::render(RenderCallback* renderCallback) { |
| 112 | auto assets = Root::singleton().assets(); |
| 113 | |
| 114 | if (m_animationFrameCooldown <= 0) { |
| 115 | if (m_opened.get() != m_currentState) { |
| 116 | if (m_currentState == 0) { |
| 117 | // opening, or flipping to the other side |
| 118 | if (!configValue("openSounds").isNull()) { |
| 119 | auto audio = make_shared<AudioInstance>(*assets->audio(Random::randValueFrom(configValue("openSounds").toArray()).toString())); |
| 120 | audio->setPosition(position()); |
| 121 | audio->setRangeMultiplier(config()->soundEffectRangeMultiplier); |
| 122 | renderCallback->addAudio(std::move(audio)); |
| 123 | } |
| 124 | } |
| 125 | if (m_currentState == configValue("openFrameIndex", 2).toInt()) { |
| 126 | // closing |
| 127 | if (!configValue("closeSounds").isNull()) { |
| 128 | auto audio = make_shared<AudioInstance>(*assets->audio(Random::randValueFrom(configValue("closeSounds").toArray()).toString())); |
| 129 | audio->setPosition(position()); |
| 130 | audio->setRangeMultiplier(config()->soundEffectRangeMultiplier); |
| 131 | renderCallback->addAudio(std::move(audio)); |
| 132 | } |
| 133 | } |
| 134 | if (m_opened.get() < m_currentState) { |
| 135 | m_currentState -= 1; |
| 136 | } else { |
| 137 | m_currentState += 1; |
| 138 | } |
| 139 | m_animationFrameCooldown = configValue("frameCooldown").toInt(); |
| 140 | } else { |
| 141 | m_animationFrameCooldown = 0; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | Object::render(renderCallback); |
| 146 | } |
| 147 | |
| 148 | void ContainerObject::destroy(RenderCallback* renderCallback) { |
| 149 | Object::destroy(renderCallback); |
nothing calls this directly
no test coverage detected