Update advances the animations of all tracked entities.
(dt float32)
| 132 | |
| 133 | // Update advances the animations of all tracked entities. |
| 134 | func (a *AnimationSystem) Update(dt float32) { |
| 135 | for _, e := range a.entities { |
| 136 | if e.AnimationComponent.CurrentAnimation == nil { |
| 137 | if e.AnimationComponent.def == nil { |
| 138 | continue |
| 139 | } |
| 140 | e.AnimationComponent.SelectAnimationByAction(e.AnimationComponent.def) |
| 141 | } |
| 142 | |
| 143 | e.AnimationComponent.change += dt |
| 144 | if e.AnimationComponent.change >= e.AnimationComponent.Rate { |
| 145 | e.RenderComponent.Drawable = e.AnimationComponent.Cell() |
| 146 | e.AnimationComponent.NextFrame() |
| 147 | } |
| 148 | } |
| 149 | } |
nothing calls this directly
no test coverage detected