| 82 | } |
| 83 | |
| 84 | void Animator::setKey(const std::string& key) |
| 85 | { |
| 86 | Debug::Log->trace("<Animator> Set Animation Key {0} for Animator at {1} {2}", key, |
| 87 | m_path.toString(), m_animations.size()); |
| 88 | if (!m_animations.empty() && m_animations.find(key) == m_animations.end()) |
| 89 | { |
| 90 | throw Exceptions::UnknownAnimation( |
| 91 | m_path.toString(), key, this->getAllAnimationName(), EXC_INFO); |
| 92 | } |
| 93 | if (key != this->getKey()) |
| 94 | { |
| 95 | bool changeAnim = false; |
| 96 | if (m_currentAnimation != nullptr) |
| 97 | { |
| 98 | if (m_currentAnimation->isOver() |
| 99 | || m_animations[key]->getPriority() |
| 100 | >= m_currentAnimation->getPriority()) |
| 101 | changeAnim = true; |
| 102 | } |
| 103 | else |
| 104 | changeAnim = true; |
| 105 | if (changeAnim) |
| 106 | { |
| 107 | if (m_currentAnimation) |
| 108 | m_currentAnimation->reset(); |
| 109 | m_currentAnimation = m_animations[key].get(); |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | void Animator::setPaused(bool pause) noexcept |
| 115 | { |
no test coverage detected