how long the animation has been playing, in seconds
whether the animation has reached the end of the preview
the frame to draw right now, or null before both choices are made
the damage preview, built once both choices are made
skips the animation to its end, the click-through a player makes
advances the animation, returning the frame to draw
The attack dialog's whole state, with no renderer: the unit selector, the damage preview the game's numbers build, and the animation clock the preview is sampled on.
The order of business is the one a player sees - choose an attacker, choose a target, and the dialog shows a blow that lands over time - so the clock is here rather than in a widget:
updatetakes the frame'sdtand returns the preview frame to draw, andfinishedsays when the animation has run out and the caller may apply the result.damageForis where the game's own rules live; this model never invents damage.Example