-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update unit generation. Add screenshot to readme.
- Loading branch information
ryankopf
committed
Aug 4, 2023
1 parent
f74a575
commit 8aec1b9
Showing
6 changed files
with
92 additions
and
29 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use crate::prelude::*; | ||
|
||
// Make plugin | ||
pub struct UnitGeneratorPlugin; | ||
|
||
impl Plugin for UnitGeneratorPlugin { | ||
fn build(&self, app: &mut App) { | ||
// app.add_system_set( | ||
// SystemSet::new() | ||
// .with_run_criteria(FixedTimestep::step(1.0)) | ||
// .with_system(unit_generator), | ||
// ); | ||
} | ||
} | ||
|
||
pub fn spawn_unit( | ||
commands: &mut Commands, | ||
position: Position, | ||
sprite_sheet: &Res<SpriteSheet>, | ||
actor_type: ActorType, | ||
food_need: f32, | ||
entertainment_need: f32, | ||
sleep_need: f32, | ||
) { | ||
let sprite = TextureAtlasSprite::new(actor_type.sprite_index()); // TO DO | ||
commands | ||
.spawn(SpriteSheetBundle { | ||
sprite, | ||
texture_atlas: sprite_sheet.0.clone(), | ||
..default() | ||
}) | ||
.insert(position) | ||
.insert(position.to_transform_layer(1.0)) | ||
.insert(Attackable) | ||
.insert( GiveMeAName ) | ||
.insert( Status { | ||
needs_food: Some(NeedsFood { current: food_need, max: 100.0, rate: 0.1 }), | ||
needs_entertainment: Some(NeedsEntertainment { current: entertainment_need, max: 100.0, rate: 0.1 }), | ||
needs_sleep: Some(NeedsSleep { current: sleep_need, max: 100.0, rate: 0.1 }), | ||
index: 0, | ||
crisis: None, | ||
danger: None, | ||
injured: false | ||
} ) | ||
.insert( Brain { ..Default::default() } ) | ||
; | ||
} |