generated from GarandPLG/rust-flake-template
00eeb97ed8
- Extend the `Task` trait with methods for progress handling and completion. - Update `DiggingTask` to store `progress` and `tick_increase`, and implement the new trait methods. - Implement the new methods in the `Tasks` enum, adding a mutable accessor. - Introduce `BoardState::get_active_tasks` and `BoardState::advance_turn` to iterate over active tasks and update their progress each turn. - Un-comment the call to `board.advance_turn()` in `SkirmishState::tick_update`.
21 lines
421 B
Rust
21 lines
421 B
Rust
use crate::app::states::skirmish_states::BoardState;
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub struct SkirmishState {
|
|
pub id: usize,
|
|
pub name: &'static str,
|
|
pub board: BoardState,
|
|
pub side_panel: bool,
|
|
pub turn_counter: u64,
|
|
}
|
|
|
|
impl SkirmishState {
|
|
pub fn tick_update(&mut self) {
|
|
self.board.advance_turn();
|
|
|
|
// if self.board.is_victory() {}
|
|
|
|
self.turn_counter += 1;
|
|
}
|
|
}
|