From 32e9a1eee243cb69bb18107d3d90055f9c9a61ad Mon Sep 17 00:00:00 2001 From: CoCoSol007 Date: Tue, 13 Feb 2024 15:01:26 +0100 Subject: [PATCH] save --- crates/border-wars/src/generation.rs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/crates/border-wars/src/generation.rs b/crates/border-wars/src/generation.rs index 7dedae0..1d38150 100644 --- a/crates/border-wars/src/generation.rs +++ b/crates/border-wars/src/generation.rs @@ -2,6 +2,7 @@ use std::collections::{HashMap, LinkedList}; +use bevy::ecs::query; use bevy::prelude::*; /// TODO @@ -65,6 +66,16 @@ impl AdjacentsPositions { }, } } + fn to_vec(&self) -> [TilePosition; 6] { + [ + self.top_left, + self.top_right, + self.bottom_left, + self.bottom_right, + self.left, + self.right, + ] + } } /// TODO @@ -100,7 +111,7 @@ fn create_adjacent_tiles( entity } -fn test(mut commands: Commands, raduis: u32) { +fn generate_map(mut commands: Commands, raduis: u32) { let mut tiles = HashMap::new(); // TODO @@ -131,6 +142,17 @@ fn test(mut commands: Commands, raduis: u32) { } } -pub fn setup(commands: Commands) { - test(commands, 2) +/// TODO +fn add_adjacent_tiles(query: Query<(Entity, &TilePosition, With)>) { + for (entity, postion, _) in query.iter() { + let adjacents = AdjacentsPositions::new_from(*postion); + for (_, adjacent_position, _) in query.iter() { + if adjacents.contains(adjacent_position) {} + } + } +} + +/// TODO +pub fn setup(commands: Commands) { + generate_map(commands, 2) }