font and cash ui

This commit is contained in:
2025-03-06 16:35:41 +01:00
parent 0e2b575620
commit a2fe9a4a5a
3 changed files with 67 additions and 4 deletions

View File

@@ -1,4 +1,8 @@
use crate::{camera::GameCameraRig, cash::Cash, tb_entities::SpawnPoint};
use crate::{
camera::GameCameraRig,
cash::{Cash, CashCollectEvent},
tb_entities::SpawnPoint,
};
use avian3d::prelude::*;
use bevy::{
input::mouse::MouseMotion,
@@ -170,7 +174,6 @@ fn collect_cash(
mut collision_event_reader: EventReader<CollisionStarted>,
query_player: Query<&Player>,
query_cash: Query<&Cash>,
asset_server: Res<AssetServer>,
) {
for CollisionStarted(e1, e2) in collision_event_reader.read() {
let collect = if query_player.contains(*e1) && query_cash.contains(*e2) {
@@ -182,7 +185,7 @@ fn collect_cash(
};
if let Some(cash) = collect {
commands.spawn(AudioPlayer::new(asset_server.load("sfx/effects/cash.ogg")));
commands.trigger(CashCollectEvent);
commands.entity(cash).despawn();
}
}