EffectBasedPlayer channel settings
This commit is contained in:
parent
e527d1da44
commit
9820eb9445
2 changed files with 13 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=30 format=3 uid="uid://co11v3w8hbwgf"]
|
[gd_scene load_steps=32 format=3 uid="uid://co11v3w8hbwgf"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"]
|
[ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="2_4pdxh"]
|
[ext_resource type="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="2_4pdxh"]
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
[ext_resource type="Script" uid="uid://b8r6fxsfjdo3a" path="res://scripts/audio/EffectBasedPlayer.cs" id="17_ltj46"]
|
[ext_resource type="Script" uid="uid://b8r6fxsfjdo3a" path="res://scripts/audio/EffectBasedPlayer.cs" id="17_ltj46"]
|
||||||
[ext_resource type="Resource" uid="uid://dsg1vjx76ifgu" path="res://resources/effects/GarlicEffect.tres" id="18_2q05d"]
|
[ext_resource type="Resource" uid="uid://dsg1vjx76ifgu" path="res://resources/effects/GarlicEffect.tres" id="18_2q05d"]
|
||||||
[ext_resource type="Resource" uid="uid://7uj0oe656jfx" path="res://resources/effects/SnowSlow.tres" id="19_ccrjo"]
|
[ext_resource type="Resource" uid="uid://7uj0oe656jfx" path="res://resources/effects/SnowSlow.tres" id="19_ccrjo"]
|
||||||
|
[ext_resource type="Script" uid="uid://c1x4n4nqyq72f" path="res://scripts/audio/ChannelSettings.cs" id="21_xnora"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_63ls2"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_63ls2"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
|
|
@ -76,6 +77,11 @@ flat_value = 0.2
|
||||||
percentage_value = 0.0
|
percentage_value = 0.0
|
||||||
mult_value = 1.0
|
mult_value = 1.0
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_dn8ha"]
|
||||||
|
script = ExtResource("21_xnora")
|
||||||
|
restartTreshold = -1.0
|
||||||
|
metadata/_custom_type_script = "uid://c1x4n4nqyq72f"
|
||||||
|
|
||||||
[node name="Zombie" type="Node2D"]
|
[node name="Zombie" type="Node2D"]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
script = ExtResource("1_qq3f1")
|
script = ExtResource("1_qq3f1")
|
||||||
|
|
@ -157,6 +163,7 @@ autostart = true
|
||||||
script = ExtResource("17_ltj46")
|
script = ExtResource("17_ltj46")
|
||||||
effectsToMap = Array[Resource]([ExtResource("18_2q05d"), ExtResource("19_ccrjo")])
|
effectsToMap = Array[Resource]([ExtResource("18_2q05d"), ExtResource("19_ccrjo")])
|
||||||
streamsToMapTo = Array[AudioStream]([ExtResource("2_hh4qh"), ExtResource("3_ltj46")])
|
streamsToMapTo = Array[AudioStream]([ExtResource("2_hh4qh"), ExtResource("3_ltj46")])
|
||||||
|
streamSettings = Array[Object]([null, SubResource("Resource_dn8ha")])
|
||||||
|
|
||||||
[connection signal="OnDamaged" from="." to="HitPlayer" method="Play"]
|
[connection signal="OnDamaged" from="." to="HitPlayer" method="Play"]
|
||||||
[connection signal="OnHPChanged" from="." to="CanvasGroup" method="DamageFlash"]
|
[connection signal="OnHPChanged" from="." to="CanvasGroup" method="DamageFlash"]
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,22 @@ public partial class EffectBasedPlayer : Node
|
||||||
{
|
{
|
||||||
[Export] public Array<Effect> effectsToMap;
|
[Export] public Array<Effect> effectsToMap;
|
||||||
[Export] public Array<AudioStream> streamsToMapTo;
|
[Export] public Array<AudioStream> streamsToMapTo;
|
||||||
private System.Collections.Generic.Dictionary<Effect, AudioStream> effectToAudioMap = new();
|
[Export] public Array<ChannelSettings> streamSettings;
|
||||||
|
private System.Collections.Generic.Dictionary<Effect, (AudioStream,ChannelSettings)> effectToAudioMap = new();
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
GetParent<Entity>().EffectStarted += OnEffectStarted;
|
GetParent<Entity>().EffectStarted += OnEffectStarted;
|
||||||
|
|
||||||
for (int i = 0; i < effectsToMap.Count; i++)
|
for (int i = 0; i < effectsToMap.Count; i++)
|
||||||
{
|
{
|
||||||
effectToAudioMap.Add(effectsToMap[i], streamsToMapTo[i]);
|
effectToAudioMap.Add(effectsToMap[i], (streamsToMapTo[i],streamSettings[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEffectStarted(Effect what)
|
public void OnEffectStarted(Effect what)
|
||||||
{
|
{
|
||||||
if (effectToAudioMap.ContainsKey(what) == false) return;
|
if (effectToAudioMap.ContainsKey(what) == false) return;
|
||||||
AudioSequencer.Play(what.Slot, effectToAudioMap[what]);
|
AudioSequencer.Play(what.Slot, effectToAudioMap[what].Item1);
|
||||||
|
AudioSequencer.ChangeSettings(what.Slot, effectToAudioMap[what].Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue