diff --git a/Zennysoft.Game.Ma.Implementation/Entity/IEnemy.cs b/Zennysoft.Game.Ma.Implementation/Entity/IEnemy.cs index fa232a50..983df546 100644 --- a/Zennysoft.Game.Ma.Implementation/Entity/IEnemy.cs +++ b/Zennysoft.Game.Ma.Implementation/Entity/IEnemy.cs @@ -21,6 +21,12 @@ namespace Zennysoft.Ma.Adapter.Entity public void OnMorph(); + public void OnBuff(); + + public void OnDebuff(); + + public void OnHealed(); + public void IncrementDefeatCount(); public int GetDefeatCount(IEnemy enemyType); @@ -39,6 +45,8 @@ namespace Zennysoft.Ma.Adapter.Entity public ElementalResistanceSet ElementalResistanceSet { get; } + public void SetEnemySpeedByMultiplier(double multiplier); + public int InitialHP { get; } public int InitialAttack { get; } diff --git a/Zennysoft.Game.Ma/src/enemy/Enemy.cs b/Zennysoft.Game.Ma/src/enemy/Enemy.cs index 95c6f136..1351d893 100644 --- a/Zennysoft.Game.Ma/src/enemy/Enemy.cs +++ b/Zennysoft.Game.Ma/src/enemy/Enemy.cs @@ -213,6 +213,23 @@ public abstract partial class Enemy : CharacterBody3D, IEnemy, IProvide roomList) { foreach (var room in roomList) @@ -233,6 +250,16 @@ public abstract partial class Enemy : CharacterBody3D, IEnemy, IProvide throw new System.NotImplementedException(); + public virtual void PlayBuffAnimation() => throw new System.NotImplementedException(); + + public virtual void PlayDebuffAnimation() => throw new System.NotImplementedException(); + + public virtual void PlayHealAnimation() => throw new System.NotImplementedException(); + + public virtual void PlayRustActivateAnimation() => throw new System.NotImplementedException(); + + public virtual void PlayRustDamageAnimation() => throw new System.NotImplementedException(); + protected virtual void OnPlayerHit(AttackEventArgs arg) => HitPlayer?.Invoke(this, arg); protected void AnimationTree_AnimationFinished(StringName animName) diff --git a/Zennysoft.Game.Ma/src/enemy/EnemyModelView2D.cs b/Zennysoft.Game.Ma/src/enemy/EnemyModelView2D.cs index 9382042b..bd163554 100644 --- a/Zennysoft.Game.Ma/src/enemy/EnemyModelView2D.cs +++ b/Zennysoft.Game.Ma/src/enemy/EnemyModelView2D.cs @@ -37,14 +37,14 @@ public partial class EnemyModelView2D : EnemyModelView, IEnemyModelView public new void OnReady() { - Hitbox.AreaEntered += Hitbox_AreaEntered; - base.OnReady(); + Hitbox.AreaEntered += Hitbox_AreaEntered; + base.OnReady(); } public override Vector2 GetSize() { - return Sprite3D.GetItemRect().Size; + return Sprite3D.GetItemRect().Size; } private void Hitbox_AreaEntered(Area3D area) => OnPlayerHit(new AttackEventArgs(AttackData)); @@ -53,144 +53,176 @@ public partial class EnemyModelView2D : EnemyModelView, IEnemyModelView public override void PlayHitAnimation() { - LoadShader("res://src/vfx/shaders/DamageHit.gdshader"); - var tweener = GetTree().CreateTween(); - tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); + LoadShader("res://src/vfx/shaders/DamageHit.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); } public override void PlayDeathAnimation() { - AnimationPlayer.Stop(); - LoadShader("res://src/vfx/shaders/PixelMelt.gdshader"); - var tweener = GetTree().CreateTween(); - tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 0.1f, 0.8f); + AnimationPlayer.Stop(); + LoadShader("res://src/vfx/shaders/PixelMelt.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 0.1f, 0.8f); + } + + public override void PlayBuffAnimation() + { + LoadShader("res://src/vfx/shaders/EnemyBuff.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); + } + + public override void PlayDebuffAnimation() + { + LoadShader("res://src/vfx/shaders/EnemyDebuff.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); + } + + public override void PlayHealAnimation() + { + LoadShader("res://src/vfx/shaders/EnemyHeal.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); + } + + public override void PlayRustActivateAnimation() + { + RustHitAnimation.Play("RustActivate"); + } + + public override void PlayRustDamageAnimation() + { + LoadShader("res://src/vfx/shaders/EnemyRust.gdshader"); + var tweener = GetTree().CreateTween(); + tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 1.0f); } public override void PlayElementalDamageAnimation(ElementType elementType) { - if (elementType == ElementType.Igneous) - { - if (FlameHitAnimation.IsPlaying()) - FlameHitAnimation.Stop(); - FlameHitAnimation.Play("FireHit"); - } - else if (elementType == ElementType.Sankta) - { - if (HolyHitAnimation.IsPlaying()) - HolyHitAnimation.Stop(); - HolyHitAnimation.Play("HolyHit"); - } - else if (elementType == ElementType.Aeolic) - { - if (WindHitAnimation.IsPlaying()) - WindHitAnimation.Stop(); - WindHitAnimation.Play("WindHit"); - } - else if (elementType == ElementType.Shura) - { - if (CurseHitAnimation.IsPlaying()) - CurseHitAnimation.Stop(); - CurseHitAnimation.Play("CurseHit"); - } - else if (elementType == ElementType.Hydric) - { - if (WaterHitAnimation.IsPlaying()) - WaterHitAnimation.Stop(); - WaterHitAnimation.Play("WaterHit"); - } - else if (elementType == ElementType.Telluric) - { - if (EarthHitAnimation.IsPlaying()) - EarthHitAnimation.Stop(); - EarthHitAnimation.Play("EarthHit"); - } - + if (elementType == ElementType.Igneous) + { + if (FlameHitAnimation.IsPlaying()) + FlameHitAnimation.Stop(); + FlameHitAnimation.Play("FireHit"); + } + else if (elementType == ElementType.Sankta) + { + if (HolyHitAnimation.IsPlaying()) + HolyHitAnimation.Stop(); + HolyHitAnimation.Play("HolyHit"); + } + else if (elementType == ElementType.Aeolic) + { + if (WindHitAnimation.IsPlaying()) + WindHitAnimation.Stop(); + WindHitAnimation.Play("WindHit"); + } + else if (elementType == ElementType.Shura) + { + if (CurseHitAnimation.IsPlaying()) + CurseHitAnimation.Stop(); + CurseHitAnimation.Play("CurseHit"); + } + else if (elementType == ElementType.Hydric) + { + if (WaterHitAnimation.IsPlaying()) + WaterHitAnimation.Stop(); + WaterHitAnimation.Play("WaterHit"); + } + else if (elementType == ElementType.Telluric) + { + if (EarthHitAnimation.IsPlaying()) + EarthHitAnimation.Stop(); + EarthHitAnimation.Play("EarthHit"); + } } private EnemyDirection GetEnemyDirection( - Basis enemyBasis, - Vector3 cameraDirection, - float rotateUpperThreshold, - float rotateLowerThreshold) + Basis enemyBasis, + Vector3 cameraDirection, + float rotateUpperThreshold, + float rotateLowerThreshold) { - var enemyForwardDirection = enemyBasis.Z; - var enemyLeftDirection = enemyBasis.X; + var enemyForwardDirection = enemyBasis.Z; + var enemyLeftDirection = enemyBasis.X; - var leftDotProduct = enemyLeftDirection.Dot(cameraDirection); - var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection); + var leftDotProduct = enemyLeftDirection.Dot(cameraDirection); + var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection); - // Check if forward facing. If the dot product is -1, the enemy is facing the camera. - if (forwardDotProduct < _lowerThreshold) - { - SetForward(); - return EnemyDirection.Forward; - } + // Check if forward facing. If the dot product is -1, the enemy is facing the camera. + if (forwardDotProduct < _lowerThreshold) + { + SetForward(); + return EnemyDirection.Forward; + } - // Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera. - else if (forwardDotProduct > rotateUpperThreshold) - { - SetBack(); - return EnemyDirection.Backward; - } - else - { - // If the dot product of the perpendicular direction is positive (up to 1), the enemy is facing to the left (since it's mirrored). - if (leftDotProduct < _lowerThreshold) - { - SetRight(); - return EnemyDirection.Left; - } + // Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera. + else if (forwardDotProduct > rotateUpperThreshold) + { + SetBack(); + return EnemyDirection.Backward; + } + else + { + // If the dot product of the perpendicular direction is positive (up to 1), the enemy is facing to the left (since it's mirrored). + if (leftDotProduct < _lowerThreshold) + { + SetRight(); + return EnemyDirection.Left; + } - // Check if side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning. - if (leftDotProduct > rotateUpperThreshold) - { - SetLeft(); - return EnemyDirection.Right; - } - } + // Check if side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning. + if (leftDotProduct > rotateUpperThreshold) + { + SetLeft(); + return EnemyDirection.Right; + } + } - return _enemyDirection; + return _enemyDirection; } private void LoadShader(string shaderPath) { - var shader = GD.Load(shaderPath); - var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast(); - foreach (var sprite in sprites) - { - sprite.Material = new ShaderMaterial(); - var shaderMaterial = (ShaderMaterial)sprite.Material; - shaderMaterial.Shader = shader; - } + var shader = GD.Load(shaderPath); + var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast(); + foreach (var sprite in sprites) + { + sprite.Material = new ShaderMaterial(); + var shaderMaterial = (ShaderMaterial)sprite.Material; + shaderMaterial.Shader = shader; + } } private void SetShaderValue(float shaderValue) { - var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast(); - foreach (var sprite in sprites) - { - var shaderMaterial = (ShaderMaterial)sprite.Material; - shaderMaterial.SetShaderParameter("progress", shaderValue); - } + var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast(); + foreach (var sprite in sprites) + { + var shaderMaterial = (ShaderMaterial)sprite.Material; + shaderMaterial.SetShaderParameter("progress", shaderValue); + } } private void SetForward() { - _enemyDirection = EnemyDirection.Forward; + _enemyDirection = EnemyDirection.Forward; } private void SetLeft() { - _enemyDirection = EnemyDirection.Left; + _enemyDirection = EnemyDirection.Left; } private void SetRight() { - _enemyDirection = EnemyDirection.Right; + _enemyDirection = EnemyDirection.Right; } private void SetBack() { - _enemyDirection = EnemyDirection.Backward; + _enemyDirection = EnemyDirection.Backward; } } diff --git a/Zennysoft.Game.Ma/src/enemy/IEnemyModelView.cs b/Zennysoft.Game.Ma/src/enemy/IEnemyModelView.cs index f2a55ab6..95e61355 100644 --- a/Zennysoft.Game.Ma/src/enemy/IEnemyModelView.cs +++ b/Zennysoft.Game.Ma/src/enemy/IEnemyModelView.cs @@ -27,6 +27,16 @@ public interface IEnemyModelView : INode3D public void PlayDeathAnimation(); + public void PlayBuffAnimation(); + + public void PlayDebuffAnimation(); + + public void PlayHealAnimation(); + + public void PlayRustActivateAnimation(); + + public void PlayRustDamageAnimation(); + public void PlayElementalDamageAnimation(ElementType elementType); public double ViewerSize { get; } diff --git a/Zennysoft.Game.Ma/src/enemy/behaviors/FleeBehavior.cs b/Zennysoft.Game.Ma/src/enemy/behaviors/FleeBehavior.cs index 33cda195..92d5ef8a 100644 --- a/Zennysoft.Game.Ma/src/enemy/behaviors/FleeBehavior.cs +++ b/Zennysoft.Game.Ma/src/enemy/behaviors/FleeBehavior.cs @@ -11,7 +11,7 @@ public partial class FleeBehavior : Node3D, IBehavior { public override void _Notification(int what) => this.Notify(what); - [Export] private double _fleeSpeed { get; set; } = 300f; + [Export] public double FleeSpeed { get; set; } = 300f; [Export] private double _thinkTime { get; set; } = 2f; @@ -52,7 +52,7 @@ public partial class FleeBehavior : Node3D, IBehavior { var nextVelocity = _navigationAgent.GetNextPathPosition(); var parent = GetParent() as Node3D; - var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)_fleeSpeed * (float)delta; + var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)FleeSpeed * (float)delta; EmitSignal(SignalName.OnVelocityComputed, velocity); } } diff --git a/Zennysoft.Game.Ma/src/enemy/behaviors/FollowBehavior.cs b/Zennysoft.Game.Ma/src/enemy/behaviors/FollowBehavior.cs index 42a92934..1e66da94 100644 --- a/Zennysoft.Game.Ma/src/enemy/behaviors/FollowBehavior.cs +++ b/Zennysoft.Game.Ma/src/enemy/behaviors/FollowBehavior.cs @@ -12,7 +12,7 @@ public partial class FollowBehavior : Node3D, IBehavior { public override void _Notification(int what) => this.Notify(what); - [Export] private double _followSpeed { get; set; } = 100f; + [Export] public double FollowSpeed { get; set; } = 100f; [Export] private double _thinkTime { get; set; } = 2f; @@ -56,7 +56,7 @@ public partial class FollowBehavior : Node3D, IBehavior { var nextVelocity = _navigationAgent.GetNextPathPosition(); var parent = GetParent() as Node3D; - var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)_followSpeed * (float)delta; + var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)FollowSpeed * (float)delta; EmitSignal(SignalName.OnVelocityComputed, velocity); } diff --git a/Zennysoft.Game.Ma/src/enemy/behaviors/PatrolBehavior.cs b/Zennysoft.Game.Ma/src/enemy/behaviors/PatrolBehavior.cs index 2067684a..c44bf926 100644 --- a/Zennysoft.Game.Ma/src/enemy/behaviors/PatrolBehavior.cs +++ b/Zennysoft.Game.Ma/src/enemy/behaviors/PatrolBehavior.cs @@ -12,7 +12,7 @@ public partial class PatrolBehavior : Node3D, IBehavior { public override void _Notification(int what) => this.Notify(what); - [Export] private double _patrolSpeed { get; set; } = 100f; + [Export] public double PatrolSpeed { get; set; } = 100f; [Export] private double _thinkTime { get; set; } = 0.8f; @@ -72,7 +72,7 @@ public partial class PatrolBehavior : Node3D, IBehavior { var nextVelocity = _navigationAgent.GetNextPathPosition(); var parent = GetParent() as Node3D; - var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)_patrolSpeed * (float)delta; + var velocity = parent.GlobalPosition.DirectionTo(nextVelocity) * (float)PatrolSpeed * (float)delta; EmitSignal(SignalName.OnVelocityComputed, velocity); } diff --git a/Zennysoft.Game.Ma/src/items/EffectService.cs b/Zennysoft.Game.Ma/src/items/EffectService.cs index 777395ca..119cc49d 100644 --- a/Zennysoft.Game.Ma/src/items/EffectService.cs +++ b/Zennysoft.Game.Ma/src/items/EffectService.cs @@ -84,6 +84,7 @@ public class EffectService return; currentRoom.EnemiesInRoom.ForEach(e => e.HealthComponent.SetCurrentHealth(e.HealthComponent.MaximumHP.Value)); + currentRoom.EnemiesInRoom.ForEach(e => e.OnHealed()); _player.HealthComponent.SetCurrentHealth(_player.HealthComponent.MaximumHP.Value); SfxDatabase.Instance.Play(SoundEffect.HealHP); } @@ -225,6 +226,11 @@ public class EffectService enemy.MoveEnemyToNewRoom(randomRoom); } + public void DisableEnemyMovement(IEnemy enemy) + { + enemy.SetEnemySpeedByMultiplier(0); + } + public void CloneEnemy(IEnemy enemy) { var enemyPosition = new Vector3(enemy.GlobalPosition.X, 0f, enemy.GlobalPosition.Z); diff --git a/Zennysoft.Game.Ma/src/items/thrown/ThrownItem.cs b/Zennysoft.Game.Ma/src/items/thrown/ThrownItem.cs index 7d6ae4ef..755531ce 100644 --- a/Zennysoft.Game.Ma/src/items/thrown/ThrownItem.cs +++ b/Zennysoft.Game.Ma/src/items/thrown/ThrownItem.cs @@ -116,35 +116,40 @@ public partial class ThrownItem : RigidBody3D, IThrownItem { case UsableItemTag.LowerTargetTo1HP: enemy.HealthComponent.SetCurrentHealth(1); - SfxDatabase.Instance.Play(SoundEffect.DecreaseStat); + enemy.OnDebuff(); break; case UsableItemTag.DecreaseAllStats: enemy.AttackComponent.Reduce(usableItem.Stats.BonusAttack); enemy.DefenseComponent.Reduce(usableItem.Stats.BonusDefense); - SfxDatabase.Instance.Play(SoundEffect.DecreaseStat); + enemy.OnDebuff(); break; case UsableItemTag.DecreaseAttack: enemy.AttackComponent.LowerMaximumAttack(usableItem.Stats.BonusAttack); - SfxDatabase.Instance.Play(SoundEffect.DecreaseStat); + enemy.OnDebuff(); break; case UsableItemTag.DecreaseDefense: enemy.DefenseComponent.LowerMaximumDefense(usableItem.Stats.BonusDefense); - SfxDatabase.Instance.Play(SoundEffect.DecreaseStat); + enemy.OnDebuff(); break; case UsableItemTag.IncreaseAttack: enemy.AttackComponent.RaiseMaximumAttack(usableItem.Stats.BonusAttack); - SfxDatabase.Instance.Play(SoundEffect.IncreaseStat); + enemy.OnBuff(); break; case UsableItemTag.IncreaseDefense: enemy.DefenseComponent.RaiseMaximumDefense(usableItem.Stats.BonusDefense); - SfxDatabase.Instance.Play(SoundEffect.IncreaseStat); + enemy.OnBuff(); break; case UsableItemTag.TeleportToRandomLocation: _effectService.TeleportToRandomRoom(enemy); SfxDatabase.Instance.Play(SoundEffect.TeleportToRandomRoom); break; + case UsableItemTag.GlueAllEquipment: + _effectService.DisableEnemyMovement(enemy); + enemy.OnDebuff(); + break; case UsableItemTag.Clone: _effectService.CloneEnemy(enemy); + enemy.OnBuff(); break; default: var damageDealt = DamageCalculator.CalculateDamage(new AttackData(usableItem.ThrowDamage, ElementType.None), enemy.DefenseComponent.CurrentDefense.Value, enemy.ElementalResistanceSet); @@ -152,6 +157,20 @@ public partial class ThrownItem : RigidBody3D, IThrownItem break; } } + else if (ItemThatIsThrown is BoxItem boxItem) + { + switch (boxItem.Stats.ItemTag) + { + case ItemTag.RestrictUnequip: + _effectService.DisableEnemyMovement(enemy); + enemy.OnDebuff(); + break; + default: + var damageDealt = DamageCalculator.CalculateDamage(new AttackData(boxItem.ThrowDamage, ElementType.None), enemy.DefenseComponent.CurrentDefense.Value, enemy.ElementalResistanceSet); + enemy.HealthComponent.Damage(damageDealt, ElementType.None); + break; + } + } else { var damageDealt = DamageCalculator.CalculateDamage(new AttackData(ItemThatIsThrown.ThrowDamage, ElementType.None), enemy.DefenseComponent.CurrentDefense.Value, enemy.ElementalResistanceSet); diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader new file mode 100644 index 00000000..9becae35 --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader @@ -0,0 +1,29 @@ +shader_type canvas_item; + +/** +Color to use for the shock. +*/ +uniform vec3 shock_color : source_color = vec3(0.0, 0.0, 0.6); +/** +Initial amplitude of the shock. This will start at this amplitude and +gradually attenuate. +*/ +uniform float amplitude = 12.0; + +uniform float progress: hint_range(0.0, 1.0) = -1.0; +/** +How fast shold it move side to side, more frequency means it'll move more quickly +side to side. +*/ +uniform float frequecy = 10.0; + +void vertex() { + float exponent = mod(progress, 3.0); + VERTEX.x += amplitude * exp(-3.0*exponent) * sin(frequecy*exponent); +} + +void fragment() { + float exponent = mod(progress, 3.0); + vec3 normal_color = texture(TEXTURE, UV).rgb; + COLOR.rgb = normal_color + shock_color * exp(-3.0*exponent); +} diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader.uid b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader.uid new file mode 100644 index 00000000..15c4c8e5 --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyBuff.gdshader.uid @@ -0,0 +1 @@ +uid://d4a0aeg7ud76g diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader new file mode 100644 index 00000000..e3e14610 --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader @@ -0,0 +1,29 @@ +shader_type canvas_item; + +/** +Color to use for the shock. +*/ +uniform vec3 shock_color : source_color = vec3(0.3, 0.0, 0.5); +/** +Initial amplitude of the shock. This will start at this amplitude and +gradually attenuate. +*/ +uniform float amplitude = 20.0; + +uniform float progress: hint_range(0.0, 1.0) = -1.0; +/** +How fast shold it move side to side, more frequency means it'll move more quickly +side to side. +*/ +uniform float frequecy = 10.0; + +void vertex() { + float exponent = mod(progress, 3.0); + VERTEX.x += amplitude * exp(-3.0*exponent) * sin(frequecy*exponent); +} + +void fragment() { + float exponent = mod(progress, 3.0); + vec3 normal_color = texture(TEXTURE, UV).rgb; + COLOR.rgb = normal_color + shock_color * exp(-3.0*exponent); +} diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader.uid b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader.uid new file mode 100644 index 00000000..8a08d872 --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyDebuff.gdshader.uid @@ -0,0 +1 @@ +uid://dv81aqs1cd1br diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader new file mode 100644 index 00000000..ca26d97c --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader @@ -0,0 +1,29 @@ +shader_type canvas_item; + +/** +Color to use for the shock. +*/ +uniform vec3 shock_color : source_color = vec3(0.0, 0.6, 0.0); +/** +Initial amplitude of the shock. This will start at this amplitude and +gradually attenuate. +*/ +uniform float amplitude = 12.0; + +uniform float progress: hint_range(0.0, 1.0) = -1.0; +/** +How fast shold it move side to side, more frequency means it'll move more quickly +side to side. +*/ +uniform float frequecy = 10.0; + +void vertex() { + float exponent = mod(progress, 3.0); + VERTEX.x += amplitude * exp(-3.0*exponent) * sin(frequecy*exponent); +} + +void fragment() { + float exponent = mod(progress, 3.0); + vec3 normal_color = texture(TEXTURE, UV).rgb; + COLOR.rgb = normal_color + shock_color * exp(-3.0*exponent); +} diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader.uid b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader.uid new file mode 100644 index 00000000..a7732ebb --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyHeal.gdshader.uid @@ -0,0 +1 @@ +uid://bgf5fav78hmuj diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader new file mode 100644 index 00000000..6f10fe73 --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader @@ -0,0 +1,29 @@ +shader_type canvas_item; + +/** +Color to use for the shock. +*/ +uniform vec3 shock_color : source_color = vec3(0.6, 0.3, 0.0); +/** +Initial amplitude of the shock. This will start at this amplitude and +gradually attenuate. +*/ +uniform float amplitude = 30.0; + +uniform float progress: hint_range(0.0, 1.0) = -1.0; +/** +How fast shold it move side to side, more frequency means it'll move more quickly +side to side. +*/ +uniform float frequecy = 10.0; + +void vertex() { + float exponent = mod(progress, 3.0); + VERTEX.x += amplitude * exp(-3.0*exponent) * sin(frequecy*exponent); +} + +void fragment() { + float exponent = mod(progress, 3.0); + vec3 normal_color = texture(TEXTURE, UV).rgb; + COLOR.rgb = normal_color + shock_color * exp(-3.0*exponent); +} diff --git a/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader.uid b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader.uid new file mode 100644 index 00000000..d84b794e --- /dev/null +++ b/Zennysoft.Game.Ma/src/vfx/shaders/EnemyRust.gdshader.uid @@ -0,0 +1 @@ +uid://uq8jl6jjs453