mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-17 12:12:41 -06:00
refactor: remove unused component, simplify visibility check defaulting behavior, reformat STORY.md
This commit is contained in:
@@ -22,10 +22,6 @@ use bevy_ecs::system::{Commands, Query, Res};
|
||||
use rand::seq::IndexedRandom;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
/// Tag component for eaten ghosts
|
||||
#[derive(Component, Debug, Clone, Copy)]
|
||||
pub struct Eaten;
|
||||
|
||||
/// Tag component for Pac-Man during his death animation.
|
||||
/// This is mainly because the Frozen tag would stop both movement and animation, while the Dying tag can signal that the animation should continue despite being frozen.
|
||||
#[derive(Component, Debug, Clone, Copy)]
|
||||
|
||||
@@ -146,7 +146,7 @@ pub fn render_system(
|
||||
// Collect and filter visible entities, then sort by layer
|
||||
let mut visible_entities: Vec<_> = renderables
|
||||
.iter()
|
||||
.filter(|(_, _, _, _, visibility)| visibility.map(|v| v.is_visible()).unwrap_or(true))
|
||||
.filter(|(_, _, _, _, visibility)| visibility.copied().unwrap_or_default().is_visible())
|
||||
.collect();
|
||||
|
||||
visible_entities.sort_by_key(|(_, renderable, _, _, _)| renderable.layer);
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::systems::SpawnTrigger;
|
||||
use crate::{
|
||||
map::builder::Map,
|
||||
systems::{
|
||||
AudioEvent, Blinking, DirectionalAnimation, Dying, Eaten, Frozen, Ghost, GhostCollider, GhostState, LinearAnimation,
|
||||
Looping, NodeId, PlayerControlled, Position, Visibility,
|
||||
AudioEvent, Blinking, DirectionalAnimation, Dying, Frozen, Ghost, GhostCollider, GhostState, LinearAnimation, Looping,
|
||||
NodeId, PlayerControlled, Position, Visibility,
|
||||
},
|
||||
};
|
||||
use bevy_ecs::{
|
||||
@@ -296,7 +296,7 @@ pub fn stage_system(
|
||||
};
|
||||
commands
|
||||
.entity(ghost_entity)
|
||||
.remove::<(Frozen, Eaten)>()
|
||||
.remove::<Frozen>()
|
||||
.insert((Visibility::visible(), GhostState::Normal));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user