generated from NiklasEi/bevy_game_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
435 additions
and
106 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
[package] | ||
name = "turtle_time" | ||
version = "0.7.3" | ||
version = "0.8.0" | ||
publish = false | ||
authors = ["Mike Eder <[email protected]>"] # ToDo: you are the author | ||
authors = ["Mike Eder <[email protected]>"] | ||
edition = "2021" | ||
exclude = ["dist", "build", "assets", "credits"] | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use bevy::prelude::*; | ||
|
||
pub const GOOSE_SPEED: i32 = 105; | ||
|
||
#[derive(Component, Default, Hash, Reflect)] | ||
#[reflect(Component, Hash)] | ||
pub struct Goose; | ||
|
||
#[derive(Component, Default, Hash, Reflect)] | ||
#[reflect(Component, Hash)] | ||
pub struct HasTarget; | ||
|
||
#[derive(Component, Default, Hash, Reflect)] | ||
#[reflect(Component, Hash)] | ||
pub struct EdibleTarget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod components; | ||
pub mod plugin; | ||
pub mod systems; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use bevy::prelude::*; | ||
use bevy_ggrs::GGRSSchedule; | ||
|
||
use crate::{ | ||
player::plugin::{EdibleSystemSet, PlayerSystemSet, SpawnSystemSet}, | ||
GameState, | ||
}; | ||
|
||
use super::systems::{ | ||
geese_target_closest_edible, goose_ate_edible, move_geese_toward_target, spawn_geese, | ||
}; | ||
|
||
pub struct GoosePlugin; | ||
|
||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)] | ||
pub struct NpcSystemSet; | ||
|
||
/// This plugin handles player related stuff like movement | ||
/// Player logic is only active during the State `GameState::Playing` | ||
impl Plugin for GoosePlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_system(spawn_geese.in_schedule(OnEnter(GameState::Playing))) | ||
.add_systems( | ||
( | ||
geese_target_closest_edible, | ||
move_geese_toward_target, | ||
goose_ate_edible, | ||
) | ||
.chain() | ||
.in_set(NpcSystemSet) | ||
.after(EdibleSystemSet) | ||
.after(SpawnSystemSet) | ||
.after(PlayerSystemSet) | ||
.distributive_run_if(in_state(GameState::Playing)) | ||
.in_schedule(GGRSSchedule), | ||
); | ||
} | ||
} |
Oops, something went wrong.