Added shadows to enemies

This commit is contained in:
Pal
2025-12-01 21:05:33 -08:00
parent fe45f0bcf2
commit 3c369f79f7
88 changed files with 1413 additions and 1044 deletions

View File

@@ -30,8 +30,8 @@ public partial class EnemyModelView2D : EnemyModelView, IEnemyModelView
public new void OnReady()
{
Hitbox.AreaEntered += Hitbox_AreaEntered;
base.OnReady();
Hitbox.AreaEntered += Hitbox_AreaEntered;
base.OnReady();
}
private void Hitbox_AreaEntered(Area3D area) => OnPlayerHit(new AttackEventArgs(AttackData));
@@ -40,102 +40,102 @@ 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()
{
LoadShader("res://src/vfx/shaders/PixelMelt.gdshader");
var tweener = GetTree().CreateTween();
tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 0.8f);
LoadShader("res://src/vfx/shaders/PixelMelt.gdshader");
var tweener = GetTree().CreateTween();
tweener.TweenMethod(Callable.From((float x) => SetShaderValue(x)), 0.0f, 1.0f, 0.8f);
}
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<Shader>(shaderPath);
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
foreach (var sprite in sprites)
{
sprite.Material = new ShaderMaterial();
var shaderMaterial = (ShaderMaterial)sprite.Material;
shaderMaterial.Shader = shader;
}
var shader = GD.Load<Shader>(shaderPath);
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
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<AnimatedSprite2D>();
foreach (var sprite in sprites)
{
var shaderMaterial = (ShaderMaterial)sprite.Material;
shaderMaterial.SetShaderParameter("progress", shaderValue);
}
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
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;
}
}

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=79 format=3 uid="uid://bimjnsu52y3xi"]
[gd_scene load_steps=80 format=3 uid="uid://bimjnsu52y3xi"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_oh25a"]
[ext_resource type="Texture2D" uid="uid://dd0ia6isdqg61" path="res://src/enemy/enemy_types/01. sproingy/animations/ATTACK/Layer 1.png" id="1_pbx41"]
@@ -59,6 +59,7 @@
[ext_resource type="Texture2D" uid="uid://b1cmx8l4ia3fv" path="res://src/enemy/enemy_types/01. sproingy/animations/IDLE_WALK_SIDE/Layer 14.png" id="54_jdvn0"]
[ext_resource type="Texture2D" uid="uid://c7t4626rox02s" path="res://src/enemy/enemy_types/01. sproingy/animations/IDLE_WALK_SIDE/Layer 15.png" id="55_2eqor"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="60_x7uye"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="61_djeua"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="62_8wbs7"]
[sub_resource type="Resource" id="Resource_ivy74"]
@@ -715,3 +716,10 @@ anim_player = NodePath("../AnimationPlayer")
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.115, 0, 0, 0, -5.02681e-09, 0.115, 0, -0.115, -5.02681e-09, -0.00018537, -1.10125, 0.0453106)
transparency = 0.1
cast_shadow = 0
texture_filter = 0
texture = ExtResource("61_djeua")

View File

@@ -18,23 +18,23 @@ public partial class Michael : Enemy2D, IHavePatrolBehavior, IHaveEngagePlayerBe
public void OnReady()
{
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
}
public void OnResolved()
{
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
}
public override void Move() => EnemyModelView.PlayIdleAnimation();
}
}

View File

@@ -56,6 +56,7 @@ shape = SubResource("CapsuleShape3D_0h5s2")
[node name="EnemyModelView" parent="." instance=ExtResource("3_wrps7")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0799522, 0, 0)
[node name="PlayerDetector" type="Area3D" parent="."]
unique_name_in_owner = true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=141 format=3 uid="uid://bjg8wyvp8q6oc"]
[gd_scene load_steps=142 format=3 uid="uid://bjg8wyvp8q6oc"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_o4cc2"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_3eot4"]
@@ -75,6 +75,7 @@
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="74_fxhv6"]
[ext_resource type="Texture2D" uid="uid://duygq1qfer5oa" path="res://src/vfx/Enemy/michael_attack.png" id="74_mip6u"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="74_pxi1p"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="76_fxhv6"]
[sub_resource type="Resource" id="Resource_gby04"]
script = ExtResource("2_3eot4")
@@ -1246,3 +1247,11 @@ sprite_frames = SubResource("SpriteFrames_suy1t")
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.38, 0, 0, 0, -1.66103e-08, 0.38, 0, -0.38, -1.66103e-08, 0.00393164, -1.31885, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("76_fxhv6")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=420 format=3 uid="uid://bup8c4x1na3aw"]
[gd_scene load_steps=421 format=3 uid="uid://bup8c4x1na3aw"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_718m1"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_krqul"]
@@ -193,6 +193,7 @@
[ext_resource type="Texture2D" uid="uid://cvivq23738fvf" path="res://src/enemy/enemy_types/03. filth_eater/animations/Filth Side Attacks Frames/ATTACK 2 SIDE/frame_072_delay-0.01s.png" id="189_uqsli"]
[ext_resource type="Texture2D" uid="uid://bxijhjyqvfrip" path="res://src/enemy/enemy_types/03. filth_eater/animations/Filth Side Attacks Frames/ATTACK 2 SIDE/frame_073_delay-0.01s.png" id="190_wg32o"]
[ext_resource type="AudioStream" uid="uid://dl818xjlcm7vu" path="res://src/audio/sfx/ENEMY_FILTH_ATTACK.ogg" id="193_4h5gj"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="193_e5pq0"]
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="193_krqul"]
[ext_resource type="Texture2D" uid="uid://d0q5jru1am4v0" path="res://src/vfx/Enemy/FILTH_BLAST.png" id="194_pyy2h"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="194_u5xjp"]
@@ -3338,6 +3339,14 @@ rotation = 0.0174533
sprite_frames = SubResource("SpriteFrames_673a4")
animation = &"idle_back_walk"
[node name="Shadow" type="Sprite3D" parent="Sprite3D"]
transform = Transform3D(0.93, 0, 0, 0, -4.06516e-08, 0.93, 0, -0.93, -4.06516e-08, 0.00393164, -0.670112, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("193_e5pq0")
[node name="Hitbox" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)

View File

@@ -23,30 +23,30 @@ public partial class Sara : Enemy2D, IHavePatrolBehavior, IHaveEngagePlayerBehav
public void OnReady()
{
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
}
public void OnResolved()
{
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
}
public override void Move() => EnemyModelView.PlayIdleAnimation();
public override void PerformAction()
{
var rng = new RandomNumberGenerator();
var options = new List<Action>() { EnemyModelView.PlayPrimaryAttackAnimation, EnemyModelView.PlaySecondaryAttackAnimation };
var selection = rng.RandWeighted([PrimaryAttackChance, SecondaryAttackChance]);
options[(int)selection].Invoke();
var rng = new RandomNumberGenerator();
var options = new List<Action>() { EnemyModelView.PlayPrimaryAttackAnimation, EnemyModelView.PlaySecondaryAttackAnimation };
var selection = rng.RandWeighted([PrimaryAttackChance, SecondaryAttackChance]);
options[(int)selection].Invoke();
}
}

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://bksq62muhk3h5"]
[gd_scene load_steps=15 format=3 uid="uid://bksq62muhk3h5"]
[ext_resource type="Script" uid="uid://jjulhqd5g3bd" path="res://src/enemy/enemy_types/04. sara/Sara.cs" id="1_3ejdn"]
[ext_resource type="PackedScene" uid="uid://2nkvacxsd46b" path="res://src/enemy/behaviors/PatrolBehavior.tscn" id="4_8ymq6"]
@@ -8,6 +8,7 @@
[ext_resource type="AudioStream" uid="uid://ba8xendacec6" path="res://src/audio/sfx/item_kyuu_layer_2.ogg" id="6_lxgpb"]
[ext_resource type="AudioStream" uid="uid://b7ycb6qvitpmw" path="res://src/audio/sfx/player_HITENEMY_3.ogg" id="7_ddchx"]
[ext_resource type="AudioStream" uid="uid://bf7adfdd857hw" path="res://src/audio/sfx/enemy_morph.ogg" id="8_746fv"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="10_746fv"]
[ext_resource type="AudioStream" uid="uid://bemrovoemoq5u" path="res://src/audio/sfx/ENEMY_APSARA_AGGRO.ogg" id="10_ddchx"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
@@ -119,3 +120,11 @@ bus = &"SFX"
unique_name_in_owner = true
stream = ExtResource("10_ddchx")
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.925, 0, 0, 0, -4.0433e-08, 0.925, 0, -0.925, -4.0433e-08, 0.00393164, -1.00089, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("10_746fv")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=172 format=3 uid="uid://c5xijwxkg4pf6"]
[gd_scene load_steps=173 format=3 uid="uid://c5xijwxkg4pf6"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_ueqp5"]
[ext_resource type="Texture2D" uid="uid://bgkx485uy065" path="res://src/enemy/enemy_types/05. ballos/animations/WALK BACK/1.png" id="3_b3ny6"]
@@ -99,6 +99,7 @@
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="97_i3hgg"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="97_ktg2j"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="98_ktg2j"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="100_ktg2j"]
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
@@ -1533,3 +1534,11 @@ unique_name_in_owner = true
stream = ExtResource("94_i3hgg")
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(1.265, 0, 0, 0, -5.52949e-08, 1.265, 0, -1.265, -5.52949e-08, 0.00393164, -1.31885, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("100_ktg2j")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=1238 format=3 uid="uid://dcm53j3rncxdm"]
[gd_scene load_steps=1239 format=3 uid="uid://dcm53j3rncxdm"]
[ext_resource type="Script" uid="uid://ckxqmb4tu4rml" path="res://src/enemy/enemy_types/06. chariot/ChariotModelView.cs" id="1_behrq"]
[ext_resource type="Texture2D" uid="uid://2gwychj1wbtx" path="res://src/enemy/enemy_types/06. chariot/animations/APPEAR/F/0051.png" id="2_1844k"]
@@ -979,6 +979,7 @@
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="976_vxyya"]
[ext_resource type="Script" uid="uid://cqm6u7qa8japr" path="res://src/system/Projectile.cs" id="978_jrkfh"]
[ext_resource type="Texture2D" uid="uid://f32ew15v8v30" path="res://src/vfx/Enemy/chariot_projectile.png" id="979_p70s4"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="980_jrkfh"]
[sub_resource type="ViewportTexture" id="ViewportTexture_vr4bf"]
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
@@ -8098,3 +8099,11 @@ libraries = {
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(1.08, 0, 0, 0, -4.72083e-08, 1.08, 0, -1.08, -4.72083e-08, 0.00393164, -1.92335, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("980_jrkfh")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=504 format=3 uid="uid://byd7cwxq1be6f"]
[gd_scene load_steps=505 format=3 uid="uid://byd7cwxq1be6f"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_6dej3"]
[ext_resource type="Texture2D" uid="uid://dnd6d5cx7x7i8" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/BACK/0400.png" id="2_3sdh3"]
@@ -396,6 +396,7 @@
[ext_resource type="Texture2D" uid="uid://csdrkeer8xklt" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/FRONT/0354.png" id="390_ksvn0"]
[ext_resource type="AudioStream" uid="uid://dr7w0i4v8qqip" path="res://src/audio/sfx/enemy_chinthe_land.ogg" id="391_5lbxl"]
[ext_resource type="AudioStream" uid="uid://bq4te4d8m0uiw" path="res://src/audio/sfx/enemy_chinthe_mainattack.ogg" id="392_li182"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="392_sgkk0"]
[ext_resource type="AudioStream" uid="uid://b0w77kgmtd3g5" path="res://src/audio/sfx/enemy_chinthe_teleport.ogg" id="393_sgkk0"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="394_ldtka"]
[ext_resource type="Texture2D" uid="uid://c7pf2dib2ilhs" path="res://src/vfx/Enemy/CHINTHE_BLAST.png" id="395_ymova"]
@@ -3522,6 +3523,14 @@ sprite_frames = SubResource("SpriteFrames_22ecf")
animation = &"idle_front_walk"
offset = Vector2(500, 500)
[node name="Shadow" type="Sprite3D" parent="Sprite3D"]
transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, 0.5, 0, -0.5, -2.18557e-08, 0.00393164, -0.943969, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("392_sgkk0")
[node name="Hitbox" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=299 format=3 uid="uid://c2i8ylr3y0bri"]
[gd_scene load_steps=300 format=3 uid="uid://c2i8ylr3y0bri"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_h27bt"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_yyynn"]
@@ -266,6 +266,7 @@
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="263_312rt"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="263_sroq1"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="264_dcx20"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="267_evddb"]
[sub_resource type="Resource" id="Resource_f45wt"]
script = ExtResource("2_yyynn")
@@ -2059,3 +2060,11 @@ bus = &"SFX"
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.835, 0, 0, 0, -3.6499e-08, 0.835, 0, -0.835, -3.6499e-08, 0.00393164, -1.31885, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("267_evddb")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=299 format=3 uid="uid://72lbcmp4bcx4"]
[gd_scene load_steps=300 format=3 uid="uid://72lbcmp4bcx4"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_a8qtn"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_xa3ug"]
@@ -261,6 +261,7 @@
[ext_resource type="Texture2D" uid="uid://dg7l1crtk7m3s" path="res://src/enemy/enemy_types/08b. Ambassador (red)/animations/SIDE/0197.png" id="259_ymdu4"]
[ext_resource type="Texture2D" uid="uid://by2vqyh68egwr" path="res://src/enemy/enemy_types/08b. Ambassador (red)/animations/SIDE/0199.png" id="260_jtq5d"]
[ext_resource type="AudioStream" uid="uid://bgumf0x52xmby" path="res://src/audio/sfx/enemy_ambassador_kick.ogg" id="261_qerwx"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="261_xxvov"]
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="262_a3dro"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="263_qerwx"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="264_xxvov"]
@@ -1976,6 +1977,14 @@ scale = Vector2(0.25, 0.25)
sprite_frames = SubResource("SpriteFrames_6drt6")
animation = &"idle_front"
[node name="Shadow" type="Sprite3D" parent="Sprite3D"]
transform = Transform3D(0.29, 0, 0, 0, -1.26763e-08, 0.29, 0, -0.29, -1.26763e-08, 0.00393164, -0.492758, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("261_xxvov")
[node name="Hitbox" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=300 format=3 uid="uid://lc5koiqn1sca"]
[gd_scene load_steps=301 format=3 uid="uid://lc5koiqn1sca"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_s0qsg"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_84ebe"]
@@ -267,6 +267,7 @@
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="264_5tr5n"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="265_yj1cx"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="266_jq47d"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="268_yj1cx"]
[sub_resource type="Resource" id="Resource_f45wt"]
script = ExtResource("2_84ebe")
@@ -2063,3 +2064,11 @@ bus = &"SFX"
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.665, 0, 0, 0, -2.90681e-08, 0.665, 0, -0.665, -2.90681e-08, 0.00393164, -1.31885, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("268_yj1cx")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=387 format=3 uid="uid://dxwwfbt2mtmer"]
[gd_scene load_steps=388 format=3 uid="uid://dxwwfbt2mtmer"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_yke7o"]
[ext_resource type="Texture2D" uid="uid://cob5mo4lrbkrp" path="res://src/enemy/enemy_types/11. Palan/animations/B/frame_000_delay-0.01s.png" id="2_lf0wi"]
@@ -211,6 +211,7 @@
[ext_resource type="Script" uid="uid://cqm6u7qa8japr" path="res://src/system/Projectile.cs" id="208_0yqqu"]
[ext_resource type="Texture2D" uid="uid://bn83xiolaxr6j" path="res://src/vfx/Enemy/PALANQUIN ATTACK 1.png" id="208_1bumx"]
[ext_resource type="Texture2D" uid="uid://dy8vmgvihf313" path="res://src/vfx/Enemy/sunlance.png" id="211_r6aec"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="212_lid5r"]
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
@@ -3025,3 +3026,11 @@ libraries = {
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(1.445, 0, 0, 0, -6.3163e-08, 1.445, 0, -1.445, -6.3163e-08, 0.00393164, -1.53476, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("212_lid5r")

View File

@@ -17,25 +17,25 @@ public partial class ShieldOfHeaven : Enemy2D, IHavePatrolBehavior, IHaveEngageP
public void OnReady()
{
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
FollowBehavior.Init(NavigationAgent);
PatrolBehavior.Init(NavigationAgent);
PatrolBehavior.HomePosition = GlobalPosition;
PatrolBehavior.OnVelocityComputed += OnVelocityComputed;
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
SetPhysicsProcess(true);
}
public override void _ExitTree()
{
PatrolBehavior.OnVelocityComputed -= OnVelocityComputed;
FollowBehavior.OnVelocityComputed -= OnVelocityComputed;
EngagePlayerBehavior.TakeAction -= EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget -= EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered -= PlayerDetector_BodyEntered;
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
PatrolBehavior.OnVelocityComputed -= OnVelocityComputed;
FollowBehavior.OnVelocityComputed -= OnVelocityComputed;
EngagePlayerBehavior.TakeAction -= EngagePlayerBehavior_TakeAction;
EngagePlayerBehavior.AcquireTarget -= EngagePlayerBehavior_AcquireTarget;
PlayerDetector.BodyEntered -= PlayerDetector_BodyEntered;
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
}
}

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://5s7c4dsb1wwk"]
[gd_scene load_steps=14 format=3 uid="uid://5s7c4dsb1wwk"]
[ext_resource type="Script" uid="uid://cjdivu0v1kfhy" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldOfHeaven.cs" id="1_oxa5b"]
[ext_resource type="PackedScene" uid="uid://drkaq6grim1fb" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldModelView.tscn" id="3_r2swr"]
@@ -8,6 +8,7 @@
[ext_resource type="AudioStream" uid="uid://ba8xendacec6" path="res://src/audio/sfx/item_kyuu_layer_2.ogg" id="6_uwf0x"]
[ext_resource type="AudioStream" uid="uid://b7ycb6qvitpmw" path="res://src/audio/sfx/player_HITENEMY_3.ogg" id="7_8rh66"]
[ext_resource type="AudioStream" uid="uid://bf7adfdd857hw" path="res://src/audio/sfx/enemy_morph.ogg" id="8_m1i5i"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="9_cacc5"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
radius = 0.226425
@@ -112,3 +113,11 @@ bus = &"SFX"
[node name="AggroSFX" type="AudioStreamPlayer3D" parent="HitSounds"]
unique_name_in_owner = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(1.955, 0, 0, 0, -8.54558e-08, 1.955, 0, -1.955, -8.54558e-08, 0.00393164, -2.8107, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("9_cacc5")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=68 format=3 uid="uid://dobiqowi8mhfi"]
[gd_scene load_steps=69 format=3 uid="uid://dobiqowi8mhfi"]
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_7w22e"]
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_ca1o5"]
@@ -49,6 +49,7 @@
[ext_resource type="Texture2D" uid="uid://cssrkfehdhgp5" path="res://src/enemy/enemy_types/13. gold sproingy/animations/GOLD_SPROING_SIDE/Layer 13.png" id="30_lcdw8"]
[ext_resource type="Texture2D" uid="uid://dl12u2wcp0fkb" path="res://src/enemy/enemy_types/13. gold sproingy/animations/GOLD_SPROING_SIDE/Layer 14.png" id="31_ie1nt"]
[ext_resource type="Texture2D" uid="uid://bcu6ei8kbcv2w" path="res://src/enemy/enemy_types/13. gold sproingy/animations/GOLD_SPROING_SIDE/Layer 15.png" id="32_u2p8a"]
[ext_resource type="Texture2D" uid="uid://dafpnwkwcukp4" path="res://src/vfx/shadow_test_1.png" id="51_smvnd"]
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="60_uwoec"]
[sub_resource type="Resource" id="Resource_ivy74"]
@@ -668,3 +669,11 @@ anim_player = NodePath("../AnimationPlayer")
unique_name_in_owner = true
autoplay = true
bus = &"SFX"
[node name="Shadow" type="Sprite3D" parent="."]
transform = Transform3D(0.29, 0, 0, 0, -1.26763e-08, 0.29, 0, -0.29, -1.26763e-08, 0.00393164, -1.31885, 0.0077811)
transparency = 0.1
cast_shadow = 0
modulate = Color(1, 1, 1, 0.591)
texture_filter = 0
texture = ExtResource("51_smvnd")

View File

@@ -25,14 +25,14 @@ public partial class DemonWallArm : EnemyModelView
public new void OnReady()
{
Hitbox.AreaEntered += Hitbox_AreaEntered;
base.OnReady();
Hitbox.AreaEntered += Hitbox_AreaEntered;
base.OnReady();
}
private void Hitbox_AreaEntered(Area3D area)
{
var target = area.GetOwner();
if (target is IPlayer player)
base.OnPlayerHit(new AttackEventArgs(AttackData));
var target = area.GetOwner();
if (target is IPlayer player)
base.OnPlayerHit(new AttackEventArgs(AttackData));
}
}