Audio: switch, fusion

This commit is contained in:
Pascal Engélibert 2022-08-24 14:51:49 +02:00
parent 297811e882
commit ec7d04c8c8
3 changed files with 21 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -33,9 +33,18 @@ pub fn setup(event_channel: Receiver<AudioMsg>) {
let color_mix_b_gain = color_mix.inp_param("gain3").unwrap();
let jump_ad = NodeId::Ad(0);
let jump_ad_trig = jump_ad.inp_param("trig").unwrap();
let switch_ad = NodeId::Ad(1);
let switch_ad_trig = switch_ad.inp_param("trig").unwrap();
let fusion_ad = NodeId::Ad(2);
let fusion_ad_trig = fusion_ad.inp_param("trig").unwrap();
let fusion_ad2 = NodeId::Ad(3);
let fusion_ad2_trig = fusion_ad2.inp_param("trig").unwrap();
for (_tick, _now) in Clock::framerate(10.0).iter() {
for (_tick, _now) in Clock::framerate(20.0).iter() {
matrix.set_param(jump_ad_trig, (0.0).into());
matrix.set_param(switch_ad_trig, (0.0).into());
matrix.set_param(fusion_ad_trig, (0.0).into());
matrix.set_param(fusion_ad2_trig, (0.0).into());
if let Ok(msg) = event_channel.try_recv() {
match msg {
@ -44,7 +53,12 @@ pub fn setup(event_channel: Receiver<AudioMsg>) {
matrix.set_param(color_mix_g_gain, g.into());
matrix.set_param(color_mix_b_gain, b.into());
}
AudioMsg::Fusion => {
matrix.set_param(fusion_ad_trig, (1.0).into());
matrix.set_param(fusion_ad2_trig, (1.0).into());
}
AudioMsg::Jump => matrix.set_param(jump_ad_trig, (1.0).into()),
AudioMsg::Switch => matrix.set_param(switch_ad_trig, (1.0).into()),
}
}
}

View file

@ -14,7 +14,9 @@ use bevy_rapier2d::prelude::*;
pub enum AudioMsg {
Color([f32; 3]),
Fusion,
Jump,
Switch,
}
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
@ -199,7 +201,6 @@ fn collision_event_system(
Ok((c2_color, c2_transform, c2_player))) =
(character_query.get(*e1), character_query.get(*e2))
{
// TODO completely remove particles
commands.entity(*e1).despawn_recursive();
commands.entity(*e2).despawn_recursive();
@ -235,6 +236,8 @@ fn collision_event_system(
true,
);
}
audio.send(AudioMsg::Fusion).ok();
}
}
}
@ -276,7 +279,7 @@ fn change_character_system(
audio
.send(AudioMsg::Color([color.0.r(), color.0.g(), color.0.b()]))
.ok();
audio.send(AudioMsg::Jump).ok();
audio.send(AudioMsg::Switch).ok();
}
player_count += 1;