MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / update

Method update

source/base/StarAnimatedPartSet.cpp:184–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void AnimatedPartSet::update(float dt) {
185 for (auto& pair : m_stateTypes) {
186 auto& stateType = pair.second;
187 auto const& state = *stateType.activeStatePointer;
188
189 stateType.activeState.timer += dt;
190 if (stateType.activeState.timer > state.cycle) {
191 if (state.animationMode == End) {
192 stateType.activeState.timer = state.cycle;
193 } else if (state.animationMode == Loop) {
194 stateType.activeState.timer = std::fmod(stateType.activeState.timer, state.cycle);
195 } else if (state.animationMode == Transition) {
196 stateType.activeState.stateName = state.transitionState;
197 stateType.activeState.timer = 0.0f;
198 stateType.activeStatePointer = stateType.states.get(state.transitionState).get();
199 }
200 }
201
202 stateType.activeStateDirty = true;
203 }
204
205 for (auto& pair : m_parts)
206 pair.second.activePartDirty = true;
207}
208
209void AnimatedPartSet::finishAnimations() {
210 for (auto& pair : m_stateTypes) {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected