Audio: switch, fusion
This commit is contained in:
parent
297811e882
commit
ec7d04c8c8
3 changed files with 21 additions and 4 deletions
File diff suppressed because one or more lines are too long
16
src/audio.rs
16
src/audio.rs
|
@ -33,9 +33,18 @@ pub fn setup(event_channel: Receiver<AudioMsg>) {
|
||||||
let color_mix_b_gain = color_mix.inp_param("gain3").unwrap();
|
let color_mix_b_gain = color_mix.inp_param("gain3").unwrap();
|
||||||
let jump_ad = NodeId::Ad(0);
|
let jump_ad = NodeId::Ad(0);
|
||||||
let jump_ad_trig = jump_ad.inp_param("trig").unwrap();
|
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(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() {
|
if let Ok(msg) = event_channel.try_recv() {
|
||||||
match msg {
|
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_g_gain, g.into());
|
||||||
matrix.set_param(color_mix_b_gain, b.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::Jump => matrix.set_param(jump_ad_trig, (1.0).into()),
|
||||||
|
AudioMsg::Switch => matrix.set_param(switch_ad_trig, (1.0).into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ use bevy_rapier2d::prelude::*;
|
||||||
|
|
||||||
pub enum AudioMsg {
|
pub enum AudioMsg {
|
||||||
Color([f32; 3]),
|
Color([f32; 3]),
|
||||||
|
Fusion,
|
||||||
Jump,
|
Jump,
|
||||||
|
Switch,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
|
||||||
|
@ -199,7 +201,6 @@ fn collision_event_system(
|
||||||
Ok((c2_color, c2_transform, c2_player))) =
|
Ok((c2_color, c2_transform, c2_player))) =
|
||||||
(character_query.get(*e1), character_query.get(*e2))
|
(character_query.get(*e1), character_query.get(*e2))
|
||||||
{
|
{
|
||||||
// TODO completely remove particles
|
|
||||||
commands.entity(*e1).despawn_recursive();
|
commands.entity(*e1).despawn_recursive();
|
||||||
commands.entity(*e2).despawn_recursive();
|
commands.entity(*e2).despawn_recursive();
|
||||||
|
|
||||||
|
@ -235,6 +236,8 @@ fn collision_event_system(
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audio.send(AudioMsg::Fusion).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +279,7 @@ fn change_character_system(
|
||||||
audio
|
audio
|
||||||
.send(AudioMsg::Color([color.0.r(), color.0.g(), color.0.b()]))
|
.send(AudioMsg::Color([color.0.r(), color.0.g(), color.0.b()]))
|
||||||
.ok();
|
.ok();
|
||||||
audio.send(AudioMsg::Jump).ok();
|
audio.send(AudioMsg::Switch).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
player_count += 1;
|
player_count += 1;
|
||||||
|
|
Loading…
Reference in a new issue