rust/lib-hwengine-future/src/ai/action.rs
author unC0Rr
Tue, 17 Dec 2024 15:44:21 +0100
branchtransitional_engine
changeset 16049 db18f1a30b0c
parent 16040 6c5b3c576fc6
permissions -rw-r--r--
Implement passing of available ammo to rust AI

#[derive(Clone)]
pub enum Direction {
    Left,
    Right,
}
#[derive(Clone)]
pub enum Action {
    Walk(Direction),
    LongJump,
    HighJump(usize),
}

pub struct Actions {
    actions: Vec<Action>,
}

impl Actions {
    pub fn new() -> Self {
        Self { actions: vec![] }
    }

    pub fn push(&mut self, action: Action) {
        self.actions.push(action)
    }

    pub fn pop(&mut self) -> Option<Action> {
        self.actions.pop()
    }
}