diff --git a/.gitignore b/.gitignore index 96ef6c0..a9d37c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/target +target Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index 389320f..a85e3dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,3 @@ homepage = "https://github.com/zkat/big-brain" [dependencies] bevy = "0.5.0" - diff --git a/examples/dorf_hero/Cargo.toml b/examples/dorf_hero/Cargo.toml new file mode 100644 index 0000000..ce6318f --- /dev/null +++ b/examples/dorf_hero/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "dorf_hero" +version = "0.1.0" +authors = ["Kat Marchán "] +edition = "2018" + +[dependencies] +bevy_tilemap = "0.4.0" +rand = "0.8.3" +pathfinding = "2.1.2" +bevy = "0.5.0" +big-brain = { path = "../../" } diff --git a/examples/dorf_hero/LICENSE b/examples/dorf_hero/LICENSE new file mode 100644 index 0000000..3f6419d --- /dev/null +++ b/examples/dorf_hero/LICENSE @@ -0,0 +1,27 @@ +This example is based on one from bevy_tilemap, found here: +https://github.com/joshuajbouw/bevy_tilemap/blob/9e19adb/examples/examples/random_dungeon.rs + +It, and the other assets in this subproject, include the following license, +reproduced here in accordance with its requirements: + +MIT License + +Copyright (c) 2020 Joshua J. Bouw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/examples/dorf_hero/assets/textures/dwarf.png b/examples/dorf_hero/assets/textures/dwarf.png new file mode 100644 index 0000000..ba76254 Binary files /dev/null and b/examples/dorf_hero/assets/textures/dwarf.png differ diff --git a/examples/dorf_hero/assets/textures/square-dwarf.png b/examples/dorf_hero/assets/textures/square-dwarf.png new file mode 100644 index 0000000..ba76254 Binary files /dev/null and b/examples/dorf_hero/assets/textures/square-dwarf.png differ diff --git a/examples/dorf_hero/assets/textures/square-evil-dwarf.png b/examples/dorf_hero/assets/textures/square-evil-dwarf.png new file mode 100644 index 0000000..5ee3b5a Binary files /dev/null and b/examples/dorf_hero/assets/textures/square-evil-dwarf.png differ diff --git a/examples/dorf_hero/assets/textures/square-floor.png b/examples/dorf_hero/assets/textures/square-floor.png new file mode 100644 index 0000000..5949b46 Binary files /dev/null and b/examples/dorf_hero/assets/textures/square-floor.png differ diff --git a/examples/dorf_hero/assets/textures/square-floor_alt.png b/examples/dorf_hero/assets/textures/square-floor_alt.png new file mode 100644 index 0000000..1898f87 Binary files /dev/null and b/examples/dorf_hero/assets/textures/square-floor_alt.png differ diff --git a/examples/dorf_hero/assets/textures/square-wall.png b/examples/dorf_hero/assets/textures/square-wall.png new file mode 100644 index 0000000..f60c69f Binary files /dev/null and b/examples/dorf_hero/assets/textures/square-wall.png differ diff --git a/examples/dorf_hero/src/ai/actions/chase.rs b/examples/dorf_hero/src/ai/actions/chase.rs new file mode 100644 index 0000000..78e3c58 --- /dev/null +++ b/examples/dorf_hero/src/ai/actions/chase.rs @@ -0,0 +1,69 @@ +use bevy::prelude::*; +use bevy_tilemap::Tilemap; +use big_brain::prelude::*; + +use crate::components::{Position, Render}; +use crate::resources::GameState; + +// Let's define our "default" action, which will be used whenever there's nothing in particular getting our dorf's attention. +#[derive(Default, Debug, Clone)] +pub struct ChaseBuilder; + +#[derive(Debug, Default, Clone)] +pub struct Chase { + +} + +impl Chase { + pub fn build() -> ChaseBuilder { + ChaseBuilder + } +} + +impl ActionBuilder for ChaseBuilder { + fn build(&self, cmd: &mut Commands, action: Entity, _actor: Entity) { + cmd.entity(action).insert(Chase::default()); + } +} + +pub fn meander_action( + mut game_state: ResMut, + time: Res