From 28dffe4ce9cf6d45f2a232f836dad7cac5f42583 Mon Sep 17 00:00:00 2001 From: CoCo_Sol007 Date: Wed, 13 Mar 2024 06:56:49 +0100 Subject: [PATCH] save --- crates/border-wars/src/actions/mod.rs | 57 +++++++++++++++++++++++++++ crates/border-wars/src/lib.rs | 1 + 2 files changed, 58 insertions(+) create mode 100644 crates/border-wars/src/actions/mod.rs diff --git a/crates/border-wars/src/actions/mod.rs b/crates/border-wars/src/actions/mod.rs new file mode 100644 index 0000000..43ac127 --- /dev/null +++ b/crates/border-wars/src/actions/mod.rs @@ -0,0 +1,57 @@ +//! All programs related to the actions that you can do with all tiles. + +use crate::map::Tile; + +pub enum Action { + Build(u32), + Destroy(u32), + Recolt(u32), + Upgrade(u32), + VillageManagement, + TroopManagement, +} + +impl Tile { + pub fn get_action(&self, index_of_tile: u8) -> Vec { + match *self { + Self::Breeding => [ + Action::Destroy(index_of_tile), + Action::Upgrade(index_of_tile), + ], + Self::Casern => [ + Action::Destroy(index_of_tile), + Action::Upgrade(index_of_tile), + Action::TroopManagement, + ], + Self::Castle => [ + Action::Upgrade(index_of_tile), + Action::VillageManagement, + ], + Self::Hill => [ + Action::Recolt(index_of_tile), + ], + Self::Grass => [ + Action::Build(index_of_tile), + ], + Self::Forest => [ + Action::Recolt(index_of_tile), + ], + Self::Mine => [ + Action::Destroy(index_of_tile), + Action::Upgrade(index_of_tile), + ], + Self::Outpost => [ + Action::Destroy(index_of_tile), + ], + Self::Sawmill => [ + Action::Destroy(index_of_tile), + Action::Recolt(index_of_tile), + ], + Self::Tower => [ + Action::Destroy(index_of_tile), + Action::Upgrade(index_of_tile), + ], + Self::Wall => [], + } + } +} diff --git a/crates/border-wars/src/lib.rs b/crates/border-wars/src/lib.rs index 257aefb..cd86293 100644 --- a/crates/border-wars/src/lib.rs +++ b/crates/border-wars/src/lib.rs @@ -2,6 +2,7 @@ use bevy::prelude::*; +pub mod actions; pub mod camera; pub mod map; pub mod responsive_scale;