Audio system and rich text
This commit is contained in:
parent
a6f817efbc
commit
68cafff083
161 changed files with 1605 additions and 255 deletions
|
|
@ -8,6 +8,8 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
{
|
||||
[Signal]
|
||||
public delegate void OnHPChangedEventHandler(int deltaHP, Node origin);
|
||||
[Signal]
|
||||
public delegate void OnDamagedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void OnLocalTimescaleChangedEventHandler(int currentTimescale);
|
||||
|
|
@ -18,6 +20,11 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
private int _maxHP;
|
||||
[Export]
|
||||
private Armor _armor;
|
||||
|
||||
[Export]
|
||||
private AudioStream garlicSound;
|
||||
[Export]
|
||||
private AudioStream freezeSound;
|
||||
|
||||
|
||||
private float _localTimescale = 1.0f;
|
||||
|
|
@ -61,7 +68,6 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
else
|
||||
_hp += amount;
|
||||
EmitSignal(SignalName.OnHPChanged,amount,origin);
|
||||
|
||||
|
||||
if (MaxHp > 0)
|
||||
{
|
||||
|
|
@ -78,6 +84,7 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
else
|
||||
_hp -= amount;
|
||||
EmitSignal(SignalName.OnHPChanged,-amount, origin);
|
||||
EmitSignal(SignalName.OnDamaged);
|
||||
|
||||
if (_hp <= 0)
|
||||
{
|
||||
|
|
@ -94,11 +101,27 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
public void GiveEffect(Effect what)
|
||||
{
|
||||
int slot = (int)what.Slot;
|
||||
if(_activeEffectSlots[slot] != null)
|
||||
if (_activeEffectSlots[slot] == null)
|
||||
{
|
||||
_effectSlotTimers[slot].Stop();
|
||||
_activeEffectSlots[slot].Exit(this);
|
||||
switch (what.Slot)
|
||||
{
|
||||
case Utility.EffectSlots.FREEZE:
|
||||
AudioSequencer.Play("zombie_freeze", freezeSound);
|
||||
var settings = new ChannelSettings();
|
||||
settings.restartTreshold = -1;
|
||||
AudioSequencer.ChangeSettings("zombie_freeze",settings);
|
||||
break;
|
||||
case Utility.EffectSlots.GARLIC:
|
||||
AudioSequencer.Play("zombie_garlic", garlicSound);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_activeEffectSlots[slot] != null)
|
||||
{
|
||||
_effectSlotTimers[slot].Stop();
|
||||
_activeEffectSlots[slot].Exit(this);
|
||||
}
|
||||
_effectSlotTimers[slot].WaitTime = what.Duration;
|
||||
_effectSlotTimers[slot].Start();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue