subtr_actor/stats/analysis_graph/nodes/
ceiling_shot.rs1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5pub struct CeilingShotNode {
6 calculator: CeilingShotCalculator,
7}
8
9impl CeilingShotNode {
10 pub fn new() -> Self {
11 Self {
12 calculator: CeilingShotCalculator::new(),
13 }
14 }
15}
16
17impl Default for CeilingShotNode {
18 fn default() -> Self {
19 Self::new()
20 }
21}
22
23impl AnalysisNode for CeilingShotNode {
24 type State = CeilingShotCalculator;
25
26 fn name(&self) -> &'static str {
27 "ceiling_shot"
28 }
29
30 fn dependencies(&self) -> NodeDependencies {
31 vec![
32 frame_info_dependency(),
33 ball_frame_state_dependency(),
34 player_frame_state_dependency(),
35 touch_state_dependency(),
36 live_play_dependency(),
37 ]
38 }
39
40 fn evaluate(&mut self, ctx: &AnalysisStateContext<'_>) -> SubtrActorResult<()> {
41 let frame = ctx.get::<FrameInfo>()?;
42 let ball = ctx.get::<BallFrameState>()?;
43 let players = ctx.get::<PlayerFrameState>()?;
44 let touch_state = ctx.get::<TouchState>()?;
45 let live_play_state = ctx.get::<LivePlayState>()?;
46 self.calculator.update_parts(
47 frame,
48 ball,
49 players,
50 &touch_state.touch_events,
51 live_play_state.is_live_play,
52 )
53 }
54
55 fn state(&self) -> &Self::State {
56 &self.calculator
57 }
58}
59
60pub(crate) fn boxed_default() -> Box<dyn AnalysisNodeDyn> {
61 Box::new(CeilingShotNode::new())
62}