rename effects.rs to visual.rs

This commit is contained in:
yuni 2024-05-10 10:37:40 +02:00
parent 932a54b460
commit 83f43ee06c
4 changed files with 18 additions and 18 deletions

View file

@ -18,7 +18,7 @@ use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*;
use bevy::scene::SceneInstance;
use bevy::math::DVec3;
use crate::{actor, audio, camera, chat, commands, effects, hud, nature, var, world};
use crate::{actor, audio, camera, chat, commands, hud, nature, var, visual, world};
use std::collections::HashMap;
pub const ENGINE_SPEED_FACTOR: f32 = 30.0;
@ -506,7 +506,7 @@ fn handle_player_death(
mut scene_spawner: ResMut<SceneSpawner>,
mut active_asteroids: ResMut<world::ActiveAsteroids>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<effects::SpawnEffectEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
mut log: ResMut<hud::Log>,
mut settings: ResMut<var::Settings>,
) {
@ -528,22 +528,22 @@ fn handle_player_death(
match death.0 {
DamageType::Mental => {
ew_effect.send(effects::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::BLACK),
ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::BLACK),
duration: 4.0,
});
}
DamageType::Asphyxiation => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::BLACK),
ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::BLACK),
duration: 1.0,
});
}
DamageType::Trauma | _ => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::MAROON),
ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::MAROON),
duration: 1.0,
});
}

View file

@ -11,7 +11,7 @@
// This module loads the chat definitions from the YAML files
// and manages the flow of conversations.
use crate::{actor, audio, effects, hud, var, world};
use crate::{actor, audio, hud, var, visual, world};
use bevy::prelude::*;
use bevy::math::DVec3;
use bevy_xpbd_3d::prelude::*;
@ -791,7 +791,7 @@ pub fn handle_chat_scripts(
mut q_player: Query<(&mut actor::Actor, &mut actor::Suit, &mut actor::ExperiencesGForce), With<actor::Player>>,
mut q_playercam: Query<(&mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<effects::SpawnEffectEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
id2pos: Res<actor::Id2Pos>,
) {
for script in er_chatscript.read() {
@ -871,15 +871,15 @@ pub fn handle_chat_scripts(
gforce.ignore_gforce_seconds = 1.0;
}
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::CYAN),
ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::CYAN),
duration: 1.0,
});
}
}
"cryofadeout" => {
ew_effect.send(effects::SpawnEffectEvent {
class: effects::Effects::FadeOut(Color::CYAN),
ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeOut(Color::CYAN),
duration: 5.1,
});
}

View file

@ -16,10 +16,10 @@ mod audio;
mod camera;
mod chat;
mod commands;
mod effects;
mod hud;
mod load;
mod var;
mod visual;
mod world;
#[allow(dead_code)]
@ -128,7 +128,7 @@ impl Plugin for OutFlyPlugin {
camera::CameraPlugin,
chat::ChatPlugin,
commands::CommandsPlugin,
effects::EffectsPlugin,
visual::VisualPlugin,
hud::HudPlugin,
load::LoadPlugin,
world::WorldPlugin,

View file

@ -13,9 +13,9 @@
use bevy::prelude::*;
use crate::{camera, var};
pub struct EffectsPlugin;
pub struct VisualPlugin;
impl Plugin for EffectsPlugin {
impl Plugin for VisualPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, setup);
app.add_systems(Startup, spawn_effects.after(setup).after(camera::setup_camera));