Skip to content

Commit

Permalink
Fix score counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Laptop765 committed Jul 23, 2024
1 parent 037c5be commit 66b7550
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/fruit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy::prelude::*;

use crate::SpatialTracked;
use crate::{Score, SpatialTracked};

#[derive(Event)]
pub struct HarvestFruitEvent {
Expand Down Expand Up @@ -56,9 +56,14 @@ pub fn sys_fruit_grow(
}
}

pub fn obs_fruit_harvested(event: Trigger<HarvestFruitEvent>, mut commands: Commands) {
pub fn obs_fruit_harvested(
event: Trigger<HarvestFruitEvent>,
mut score: ResMut<Score>,
mut commands: Commands,
) {
info!("Triggered fruit harvest");

**score += 1;
commands.entity(event.entity()).insert((
FruitGrowthState::Empty {
seconds_remaining: 6.0,
Expand Down

0 comments on commit 66b7550

Please sign in to comment.