Skip to main content

subtr_actor/stats/analysis_graph/nodes/
wall_aerial.rs

1use super::*;
2use crate::stats::calculators::*;
3use crate::*;
4
5pub struct WallAerialNode {
6    calculator: WallAerialCalculator,
7}
8
9impl WallAerialNode {
10    pub fn new() -> Self {
11        Self {
12            calculator: WallAerialCalculator::new(),
13        }
14    }
15}
16
17impl Default for WallAerialNode {
18    fn default() -> Self {
19        Self::new()
20    }
21}
22
23impl AnalysisNode for WallAerialNode {
24    type State = WallAerialCalculator;
25
26    fn name(&self) -> &'static str {
27        "wall_aerial"
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
47            .update(frame, ball, players, touch_state, live_play_state)
48    }
49
50    fn state(&self) -> &Self::State {
51        &self.calculator
52    }
53}
54
55pub(crate) fn boxed_default() -> Box<dyn AnalysisNodeDyn> {
56    Box::new(WallAerialNode::new())
57}