diff --git a/solitaire_engine/src/card_plugin.rs b/solitaire_engine/src/card_plugin.rs index 046bd29..fce5e63 100644 --- a/solitaire_engine/src/card_plugin.rs +++ b/solitaire_engine/src/card_plugin.rs @@ -82,11 +82,28 @@ pub struct HintHighlight { pub remaining: f32, } +/// Countdown (seconds) until the `HintHighlight` on a card entity is removed. +/// +/// Inserted alongside `HintHighlight` by the hint-visual system. When the timer +/// reaches zero both `HintHighlight` and `HintHighlightTimer` are removed from +/// the entity and the sprite colour is restored. +#[derive(Component, Debug, Clone)] +pub struct HintHighlightTimer(pub f32); + /// Marker on a `PileMarker` entity that is highlighted because the right-clicked /// card can legally be placed there. #[derive(Component, Debug)] pub struct RightClickHighlight; +/// Countdown (seconds) until this right-click destination highlight despawns. +/// +/// Inserted alongside `RightClickHighlight` so that highlights auto-clear after +/// 1.5 s even if the player does not make a move or click again. The existing +/// clear-on-state-change and clear-on-pause logic still fires early when +/// appropriate. +#[derive(Component, Debug, Clone)] +pub struct RightClickHighlightTimer(pub f32); + /// Marker placed on the child `Text2d` entity that shows "↺" on the stock pile /// marker when the stock pile is empty. #[derive(Component, Debug)] @@ -154,6 +171,7 @@ impl Plugin for CardPlugin { update_drag_shadow, tick_hint_highlight, handle_right_click, + tick_right_click_highlights, clear_right_click_highlights_on_state_change.after(GameMutation), clear_right_click_highlights_on_pause, update_stock_empty_indicator.after(GameMutation), @@ -627,7 +645,8 @@ fn update_drag_shadow( // --------------------------------------------------------------------------- /// Counts down `HintHighlight::remaining` each frame. When it reaches zero, -/// removes the component and resets the card sprite to its normal face-up colour. +/// removes both `HintHighlight` and `HintHighlightTimer` (if present) and +/// resets the card sprite to its normal face-up colour. fn tick_hint_highlight( time: Res