diff --git a/Resources/Bullets/3D/rice_bullet_small_blue_3D.tres b/Resources/Bullets/3D/rice_bullet_small_blue_3D.tres index b74cf423..e4801428 100644 --- a/Resources/Bullets/3D/rice_bullet_small_blue_3D.tres +++ b/Resources/Bullets/3D/rice_bullet_small_blue_3D.tres @@ -10,14 +10,9 @@ BulletScene = ExtResource("1_8m7mi") BulletSprite = ExtResource("2_p44mg") BulletSize = 0.08 BulletSpeed = 2.5 -Direction = Vector2(1, 0) BulletDamage = 20.0 -MaxDamage = 1.0 -Knockback = 1.0 LifeTime = 20.0 Owner = 2 -DamageType = 0 -GrazeValue = 0.2 Attributes = 98 -TimeModifiers = null +TimeModifiers = [] metadata/_custom_type_script = "uid://dslyrfcej3g2n" diff --git a/Resources/Bullets/3D/simple_enemy_bullet_small_3D.tres b/Resources/Bullets/3D/simple_enemy_bullet_small_3D.tres index 555c2e89..89d52a73 100644 --- a/Resources/Bullets/3D/simple_enemy_bullet_small_3D.tres +++ b/Resources/Bullets/3D/simple_enemy_bullet_small_3D.tres @@ -1,22 +1,17 @@ [gd_resource type="Resource" script_class="BulletResource" load_steps=4 format=3 uid="uid://qrqsywgiij7i"] -[ext_resource type="PackedScene" uid="uid://c133312rx63ps" path="res://Scenes/Weapons/base_enemy_bullet_3D_small.tscn" id="1_pm333"] +[ext_resource type="PackedScene" uid="uid://d28e1t2c0lwbp" path="res://Scenes/Weapons/base_enemy_bullet_3D.tscn" id="1_wf025"] [ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="2_4bl80"] [ext_resource type="Texture2D" uid="uid://bdyd0bht18n47" path="res://Sprites/EnemyProjectile.png" id="2_e1tuw"] [resource] script = ExtResource("2_4bl80") -BulletScene = ExtResource("1_pm333") +BulletScene = ExtResource("1_wf025") BulletSprite = ExtResource("2_e1tuw") BulletSize = 0.08 BulletSpeed = 2.5 -Direction = Vector2(1, 0) BulletDamage = 8.0 -MaxDamage = 1.0 -Knockback = 1.0 -LifeTime = 10.0 Owner = 2 -DamageType = 0 GrazeValue = 1.0 Attributes = 290 TimeModifiers = [] diff --git a/Resources/Bullets/simple_enemy_bullet.tres b/Resources/Bullets/simple_enemy_bullet.tres index f52ed5d7..3ab42969 100644 --- a/Resources/Bullets/simple_enemy_bullet.tres +++ b/Resources/Bullets/simple_enemy_bullet.tres @@ -7,18 +7,8 @@ script = ExtResource("1_o3tyw") BulletScene = ExtResource("1_vsj6i") BulletSpeed = 60.0 -Direction = Vector2(1, 0) BulletDamage = 12.0 -MaxDamage = 1.0 -Knockback = 1.0 -LifeTime = 10.0 -DestroyOnCollision = true Owner = 2 -DamageType = 0 -RotateSprite = false -Controllable = false -Freezable = true -Grazeable = true GrazeValue = 1.0 Attributes = 290 TimeModifiers = [] diff --git a/Resources/Materials/Player_Blink_Teleport_Material_3D.tres b/Resources/Materials/Player_Blink_Teleport_Material_3D.tres index c1485758..b60ed4c7 100644 --- a/Resources/Materials/Player_Blink_Teleport_Material_3D.tres +++ b/Resources/Materials/Player_Blink_Teleport_Material_3D.tres @@ -12,7 +12,7 @@ resource_local_to_scene = true render_priority = 0 shader = ExtResource("1_s52cn") shader_parameter/tex = SubResource("AtlasTexture_h5qtm") -shader_parameter/blink_color = Color(0.954799, 0.00675169, 0, 1) +shader_parameter/blink_color = Color(0.9529412, 0.007843138, 0, 1) shader_parameter/blink_intensity = 0.0 shader_parameter/teleport_progress = 0.0 shader_parameter/scanline_density = 0.0 diff --git a/Resources/Particles/graze_particle.tres b/Resources/Particles/graze_particle.tres new file mode 100644 index 00000000..e8007b4a --- /dev/null +++ b/Resources/Particles/graze_particle.tres @@ -0,0 +1,7 @@ +[gd_resource type="ParticleProcessMaterial" format=3 uid="uid://k221i4n2f67e"] + +[resource] +particle_flag_disable_z = true +spread = 180.0 +initial_velocity_max = 73.59 +gravity = Vector3(0, 0, 0) diff --git a/Resources/Particles/graze_particle_3D.tres b/Resources/Particles/graze_particle_3D.tres new file mode 100644 index 00000000..a545c445 --- /dev/null +++ b/Resources/Particles/graze_particle_3D.tres @@ -0,0 +1,10 @@ +[gd_resource type="ParticleProcessMaterial" format=3 uid="uid://ogkwkokxevat"] + +[resource] +angle_min = -294.4 +angle_max = 124.10001 +spread = 180.0 +initial_velocity_min = 4.0 +initial_velocity_max = 4.0 +gravity = Vector3(0, 0, 0) +color = Color(0.45030138, 0.73216647, 1.3569999, 1) diff --git a/Scenes/Actors/IsoPlayer_FSM.tscn b/Scenes/Actors/IsoPlayer_FSM.tscn index d2706821..73ac3829 100644 --- a/Scenes/Actors/IsoPlayer_FSM.tscn +++ b/Scenes/Actors/IsoPlayer_FSM.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=67 format=3 uid="uid://rimplblbptcd"] +[gd_scene load_steps=69 format=3 uid="uid://rimplblbptcd"] [ext_resource type="Script" uid="uid://88smibkin17p" path="res://Scripts/Components/FSM/3DPlayer/IsoPlayerFSMProxy.cs" id="1_cc7e7"] [ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="1_vex34"] @@ -38,6 +38,7 @@ [ext_resource type="Texture2D" uid="uid://bf37ce6jskdel" path="res://Sprites/SmallHitbox.png" id="32_chmen"] [ext_resource type="Script" uid="uid://byiv30s1ahdyh" path="res://Scripts/Components/Actors/3D/PlayerCrosshairModule3D.cs" id="33_iw7um"] [ext_resource type="Texture2D" uid="uid://cf2855sd3hqty" path="res://Sprites/Actors/Aiming_Reticule_Small.png" id="34_chmen"] +[ext_resource type="Script" uid="uid://pqsd8h60urrc" path="res://Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs" id="39_gndug"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_fg04g"] radius = 0.342937 @@ -63,26 +64,21 @@ radius = 1.20117 [sub_resource type="Resource" id="Resource_c4ide"] script = ExtResource("27_5v3dv") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_fjg1v"] script = ExtResource("27_5v3dv") DamageType = 1 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_hed00"] script = ExtResource("27_5v3dv") DamageType = 2 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_q2flx"] script = ExtResource("27_5v3dv") DamageType = 3 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_k7ckg"] @@ -99,14 +95,11 @@ metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_v2m0j"] script = ExtResource("27_5v3dv") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_awrib"] script = ExtResource("27_5v3dv") DamageType = 1 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_nfrn8"] @@ -123,20 +116,16 @@ metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_m1iep"] script = ExtResource("27_5v3dv") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_ckpe7"] script = ExtResource("27_5v3dv") DamageType = 4 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_p5rkw"] script = ExtResource("27_5v3dv") DamageType = 5 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="SphereShape3D" id="SphereShape3D_p313o"] @@ -202,6 +191,10 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="CylinderShape3D" id="CylinderShape3D_nk07c"] +height = 0.91430664 +radius = 0.80566406 + [node name="IsoPlayerFsm" type="CharacterBody3D" node_paths=PackedStringArray("PlayerFSM")] collision_layer = 2 collision_mask = 17 @@ -220,7 +213,7 @@ _inputProvider = NodePath("../../InputProvider") AnimationProvider = NodePath("../../AnimationProvider") Storage = NodePath("../../Storage") DamageReceiver = NodePath("../../DamageReceiver") -_moduleNodes = [NodePath("../../InputProvider"), NodePath("../../MovementModule"), NodePath("../../ShadowModule"), NodePath("../../InteractionController"), NodePath("../../ActivationProvider"), NodePath("../../WeaponModule"), NodePath("../../CrosshairModule")] +_moduleNodes = [NodePath("../../InputProvider"), NodePath("../../MovementModule"), NodePath("../../ShadowModule"), NodePath("../../InteractionController"), NodePath("../../ActivationProvider"), NodePath("../../WeaponModule"), NodePath("../../CrosshairModule"), NodePath("../../GrazingModule")] [node name="Dead" type="Node" parent="StateMachine" node_paths=PackedStringArray("_motivationProvider", "_inputProvider", "_healthProvider", "_animationProvider")] script = ExtResource("5_ok250") @@ -449,5 +442,15 @@ texture_filter = 0 render_priority = 1 sprite_frames = SubResource("SpriteFrames_gndug") +[node name="GrazingModule" type="Area3D" parent="." node_paths=PackedStringArray("Shield")] +collision_layer = 0 +collision_mask = 128 +script = ExtResource("39_gndug") +Shield = NodePath("../DamageReceiver/ShieldProvider") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="GrazingModule"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.12463379, 0) +shape = SubResource("CylinderShape3D_nk07c") + [connection signal="area_entered" from="AcidDetector" to="AcidDeathModule" method="OnAcidCollision"] [connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"] diff --git a/Scenes/Actors/fsm_player.tscn b/Scenes/Actors/fsm_player.tscn index 97b54a76..5cf77127 100644 --- a/Scenes/Actors/fsm_player.tscn +++ b/Scenes/Actors/fsm_player.tscn @@ -124,26 +124,21 @@ animations = [{ [sub_resource type="Resource" id="Resource_c4ide"] script = ExtResource("25_12erk") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_fjg1v"] script = ExtResource("25_12erk") DamageType = 1 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_hed00"] script = ExtResource("25_12erk") DamageType = 2 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_q2flx"] script = ExtResource("25_12erk") DamageType = 3 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_k7ckg"] @@ -160,14 +155,11 @@ metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_v2m0j"] script = ExtResource("25_12erk") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_awrib"] script = ExtResource("25_12erk") DamageType = 1 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_nfrn8"] @@ -184,20 +176,16 @@ metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_m1iep"] script = ExtResource("25_12erk") -DamageType = 0 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_ckpe7"] script = ExtResource("25_12erk") DamageType = 4 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="Resource" id="Resource_p5rkw"] script = ExtResource("25_12erk") DamageType = 5 -Attribute = 0 metadata/_custom_type_script = "uid://ddsqqfx1usc3j" [sub_resource type="CircleShape2D" id="CircleShape2D_igu66"] @@ -209,61 +197,6 @@ radius = 17.2627 [sub_resource type="CircleShape2D" id="CircleShape2D_g3wua"] radius = 9.0 -[sub_resource type="AnimationNodeTransition" id="AnimationNodeTransition_es1gk"] -input_0/name = "up" -input_0/auto_advance = false -input_0/break_loop_at_end = false -input_0/reset = true -input_1/name = "down" -input_1/auto_advance = false -input_1/break_loop_at_end = false -input_1/reset = true -input_2/name = "left" -input_2/auto_advance = false -input_2/break_loop_at_end = false -input_2/reset = true -input_3/name = "right" -input_3/auto_advance = false -input_3/break_loop_at_end = false -input_3/reset = true - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4f2wn"] -animation = &"Walk_Down" - -[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_fnw0c"] -blend_point_0/node = SubResource("AnimationNodeAnimation_4f2wn") -blend_point_0/pos = 0.0 - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_12erk"] -animation = &"Walk_Up" - -[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_c4ide"] -blend_point_0/node = SubResource("AnimationNodeAnimation_12erk") -blend_point_0/pos = 0.0 - -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_fjg1v"] -graph_offset = Vector2(-110.364, 39.7151) -nodes/Transition/node = SubResource("AnimationNodeTransition_es1gk") -nodes/Transition/position = Vector2(706.667, 53.3333) -nodes/Walk_Down/node = SubResource("AnimationNodeBlendSpace1D_fnw0c") -nodes/Walk_Down/position = Vector2(426.667, 253.333) -nodes/Walk_Up/node = SubResource("AnimationNodeBlendSpace1D_c4ide") -nodes/Walk_Up/position = Vector2(426.667, 53.3333) -nodes/output/position = Vector2(280, 133.333) -node_connections = [&"Transition", 0, &"Walk_Up", &"Transition", 1, &"Walk_Down"] - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hed00"] -advance_mode = 2 - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_q2flx"] -advance_mode = 2 - -[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_k7ckg"] -states/BlendTree/node = SubResource("AnimationNodeBlendTree_fjg1v") -states/BlendTree/position = Vector2(401.333, 98.4444) -states/Start/position = Vector2(192, 98.963) -transitions = ["Start", "BlendTree", SubResource("AnimationNodeStateMachineTransition_hed00"), "BlendTree", "End", SubResource("AnimationNodeStateMachineTransition_q2flx")] - [sub_resource type="Animation" id="Animation_awrib"] length = 0.001 tracks/0/type = "value" @@ -320,6 +253,61 @@ _data = { &"Walk_Up": SubResource("Animation_v2m0j") } +[sub_resource type="AnimationNodeTransition" id="AnimationNodeTransition_es1gk"] +input_0/name = "up" +input_0/auto_advance = false +input_0/break_loop_at_end = false +input_0/reset = true +input_1/name = "down" +input_1/auto_advance = false +input_1/break_loop_at_end = false +input_1/reset = true +input_2/name = "left" +input_2/auto_advance = false +input_2/break_loop_at_end = false +input_2/reset = true +input_3/name = "right" +input_3/auto_advance = false +input_3/break_loop_at_end = false +input_3/reset = true + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4f2wn"] +animation = &"Walk_Down" + +[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_fnw0c"] +blend_point_0/node = SubResource("AnimationNodeAnimation_4f2wn") +blend_point_0/pos = 0.0 + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_12erk"] +animation = &"Walk_Up" + +[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_c4ide"] +blend_point_0/node = SubResource("AnimationNodeAnimation_12erk") +blend_point_0/pos = 0.0 + +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_fjg1v"] +graph_offset = Vector2(-110.364, 39.7151) +nodes/output/position = Vector2(280, 133.333) +nodes/Transition/node = SubResource("AnimationNodeTransition_es1gk") +nodes/Transition/position = Vector2(706.667, 53.3333) +nodes/Walk_Down/node = SubResource("AnimationNodeBlendSpace1D_fnw0c") +nodes/Walk_Down/position = Vector2(426.667, 253.333) +nodes/Walk_Up/node = SubResource("AnimationNodeBlendSpace1D_c4ide") +nodes/Walk_Up/position = Vector2(426.667, 53.3333) +node_connections = [&"Transition", 0, &"Walk_Up", &"Transition", 1, &"Walk_Down"] + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hed00"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_q2flx"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_k7ckg"] +states/BlendTree/node = SubResource("AnimationNodeBlendTree_fjg1v") +states/BlendTree/position = Vector2(401.333, 98.4444) +states/Start/position = Vector2(192, 98.963) +transitions = ["Start", "BlendTree", SubResource("AnimationNodeStateMachineTransition_hed00"), "BlendTree", "End", SubResource("AnimationNodeStateMachineTransition_q2flx")] + [sub_resource type="CircleShape2D" id="CircleShape2D_fnw0c"] radius = 2.05679 @@ -550,13 +538,16 @@ vframes = 4 [node name="AnimationTree" type="AnimationTree" parent="."] root_node = NodePath(".") +libraries = { +&"": SubResource("AnimationLibrary_nfrn8") +} tree_root = SubResource("AnimationNodeStateMachine_k7ckg") anim_player = NodePath("AnimationPlayer") parameters/BlendTree/Transition/current_state = "" parameters/BlendTree/Transition/transition_request = "" parameters/BlendTree/Transition/current_index = -1 -parameters/BlendTree/Walk_Down/blend_position = 0 -parameters/BlendTree/Walk_Up/blend_position = 0 +parameters/BlendTree/Walk_Down/blend_position = 0.0 +parameters/BlendTree/Walk_Up/blend_position = 0.0 [node name="AnimationPlayer" type="AnimationPlayer" parent="AnimationTree"] libraries = { @@ -600,7 +591,6 @@ script = ExtResource("42_awrib") Shield = NodePath("../DamageReceiver/ShieldProvider") [node name="CollisionShape2D" type="CollisionShape2D" parent="GrazingModule"] -visible = false shape = SubResource("CircleShape2D_awrib") [node name="FreezeModule" type="Node2D" parent="." node_paths=PackedStringArray("Shield", "InputProvider")] diff --git a/Scenes/Weapons/Bullets/enemyBullet_mid_red.tscn b/Scenes/Weapons/Bullets/enemyBullet_mid_red.tscn index 2aad289d..76a8c204 100644 --- a/Scenes/Weapons/Bullets/enemyBullet_mid_red.tscn +++ b/Scenes/Weapons/Bullets/enemyBullet_mid_red.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=3 uid="uid://bi3f14klscvlw"] +[gd_scene load_steps=7 format=3 uid="uid://bi3f14klscvlw"] [ext_resource type="Script" uid="uid://dsa4b75hdig8p" path="res://Scripts/Bullet.cs" id="1_jnw2a"] [ext_resource type="Texture2D" uid="uid://cfldr7l7dearo" path="res://Sprites/Bullets/mid_bullet_red.png" id="2_4q6eb"] [ext_resource type="PackedScene" uid="uid://m88tchaflpln" path="res://Scenes/Misc/graze_sound.tscn" id="3_1ntfi"] [ext_resource type="PackedScene" uid="uid://ce83htrsiu7qa" path="res://Scenes/Misc/graze_particles.tscn" id="4_q1b4v"] +[ext_resource type="Material" uid="uid://k221i4n2f67e" path="res://Resources/Particles/graze_particle.tres" id="5_q1b4v"] [sub_resource type="CircleShape2D" id="CircleShape2D_jxptd"] radius = 2.23607 @@ -26,6 +27,7 @@ shape = SubResource("CircleShape2D_jxptd") [node name="AudioStreamPlayer2D" parent="." instance=ExtResource("3_1ntfi")] [node name="GrazeParticles" parent="." instance=ExtResource("4_q1b4v")] +process_material = ExtResource("5_q1b4v") [connection signal="area_entered" from="." to="." method="_on_area_entered"] [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/Scenes/Weapons/base_enemy_bullet_3D.tscn b/Scenes/Weapons/base_enemy_bullet_3D.tscn index d52e4a88..93cc2399 100644 --- a/Scenes/Weapons/base_enemy_bullet_3D.tscn +++ b/Scenes/Weapons/base_enemy_bullet_3D.tscn @@ -1,11 +1,22 @@ -[gd_scene load_steps=4 format=3 uid="uid://d28e1t2c0lwbp"] +[gd_scene load_steps=8 format=3 uid="uid://d28e1t2c0lwbp"] [ext_resource type="Script" uid="uid://cg6y36s7buapp" path="res://Scripts/Weapons/Bullet3D.cs" id="1_xnqcl"] [ext_resource type="Texture2D" uid="uid://cfldr7l7dearo" path="res://Sprites/Bullets/mid_bullet_red.png" id="2_xnqcl"] +[ext_resource type="AudioStream" uid="uid://b3rm0vj6x54k4" path="res://SFX/th_knockoff_sfx/click_collect.wav" id="3_xyes7"] +[ext_resource type="Material" uid="uid://ogkwkokxevat" path="res://Resources/Particles/graze_particle_3D.tres" id="4_t5ure"] [sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"] radius = 0.161126 +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t5ure"] +vertex_color_use_as_albedo = true + +[sub_resource type="QuadMesh" id="QuadMesh_nd0aw"] +lightmap_size_hint = Vector2i(2, 2) +material = SubResource("StandardMaterial3D_t5ure") +size = Vector2(0.1, 0.1) +orientation = 1 + [node name="Bullet" type="Area3D" groups=["bullets"]] collision_layer = 128 collision_mask = 23 @@ -24,6 +35,20 @@ shape = SubResource("SphereShape3D_pklkt") [node name="VisibleOnScreenNotifier" type="VisibleOnScreenNotifier3D" parent="."] +[node name="GrazeSound" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource("3_xyes7") +bus = &"Effects" + +[node name="GrazeParticles" type="GPUParticles3D" parent="."] +transform = Transform3D(0.70710677, 0.49999997, 0.49999997, 0, 0.70710677, -0.70710677, -0.70710677, 0.49999997, 0.49999997, 0, 0, 0) +emitting = false +amount = 2 +lifetime = 0.2 +one_shot = true +local_coords = true +process_material = ExtResource("4_t5ure") +draw_pass_1 = SubResource("QuadMesh_nd0aw") + [connection signal="area_entered" from="." to="." method="_on_area_entered"] [connection signal="body_entered" from="." to="." method="_on_body_entered"] [connection signal="screen_exited" from="VisibleOnScreenNotifier" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"] diff --git a/Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs b/Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs index ac07d28b..2b1fa263 100644 --- a/Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs +++ b/Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs @@ -33,10 +33,14 @@ public partial class PlayerAnimationProvider3D : Node3D private GTween _blinkTween; [Signal] public delegate void OnAnimationEndedEventHandler(StringName animationName); + + private ShaderMaterial _shaderMaterial; public override void _Ready() { AnimatedSprite.AnimationFinished += () => EmitSignal(SignalName.OnAnimationEnded, AnimatedSprite.Animation); + + _shaderMaterial = ((ShaderMaterial)AnimatedSprite.MaterialOverride); } public void ShowSprite() @@ -115,7 +119,7 @@ public partial class PlayerAnimationProvider3D : Node3D AnimatedSprite.SpeedScale = 1; } - public void Blink() + public void Blink(bool health = true) { if (AnimatedSprite.MaterialOverride is null) { @@ -124,13 +128,22 @@ public partial class PlayerAnimationProvider3D : Node3D //if (BlinkMaterial == null) return; //AnimatedSprite.MaterialOverride = BlinkMaterial; - var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); + //var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); + + if (health) + { + SetShaderBlinkColor(Colors.Red); + } + else + { + SetShaderBlinkColor(Colors.Blue); + } _blinkTween?.Kill(); _blinkTween = GTweenSequenceBuilder.New() - .Append(material.TweenPropertyFloat(BlinkShaderPropertyName, 1f, 0f)) - .Append(material.TweenPropertyFloat(BlinkShaderPropertyName, 0f, 0.5f)) + .Append(_shaderMaterial.TweenPropertyFloat(BlinkShaderPropertyName, 1f, 0f)) + .Append(_shaderMaterial.TweenPropertyFloat(BlinkShaderPropertyName, 0f, 0.5f)) .Build(); _blinkTween.Play(); @@ -142,15 +155,14 @@ public partial class PlayerAnimationProvider3D : Node3D { return; } - //if (BlinkMaterial == null) return; - //AnimatedSprite.MaterialOverride = BlinkMaterial; - var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); + + //var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); _blinkTween?.Kill(); _blinkTween = GTweenSequenceBuilder.New() - .Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f, 0f)) - .Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 0f, 0f)) - .Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,50f,0.5f)) - .Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f,0.5f)) + .Append(_shaderMaterial.TweenPropertyFloat(TeleportProgressPropertyName, 0f, 0f)) + .Append(_shaderMaterial.TweenPropertyFloat(ScanlineDensityPropertyName, 0f, 0f)) + .Append(_shaderMaterial.TweenPropertyFloat(ScanlineDensityPropertyName,50f,0.5f)) + .Join(_shaderMaterial.TweenPropertyFloat(TeleportProgressPropertyName, 1f,0.5f)) .Build(); _blinkTween.Play(); @@ -162,37 +174,41 @@ public partial class PlayerAnimationProvider3D : Node3D { return; } - //if (BlinkMaterial == null) return; - //AnimatedSprite.MaterialOverride = BlinkMaterial; - var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); + + //var material = ((ShaderMaterial)AnimatedSprite.MaterialOverride); _blinkTween?.Kill(); _blinkTween = GTweenSequenceBuilder.New() - .Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f, 0f)) - .Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 50f, 0f)) - .Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,0f,0.5f)) - .Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f,0.5f)) + .Append(_shaderMaterial.TweenPropertyFloat(TeleportProgressPropertyName, 1f, 0f)) + .Append(_shaderMaterial.TweenPropertyFloat(ScanlineDensityPropertyName, 50f, 0f)) + .Append(_shaderMaterial.TweenPropertyFloat(ScanlineDensityPropertyName,0f,0.5f)) + .Join(_shaderMaterial.TweenPropertyFloat(TeleportProgressPropertyName, 0f,0.5f)) .Build(); _blinkTween.Play(); } - + + private void SetShaderBlinkColor(Color value) + { + _shaderMaterial.SetShaderParameter("blink_color", value); + } + private void SetShaderTeleportProgress(float value) { - ((ShaderMaterial)AnimatedSprite.MaterialOverride).SetShaderParameter("teleport_progress", value); + _shaderMaterial.SetShaderParameter("teleport_progress", value); } private void SetShaderScanlineDensity(float value) { - ((ShaderMaterial)AnimatedSprite.MaterialOverride).SetShaderParameter("scanline_density", value); + _shaderMaterial.SetShaderParameter("scanline_density", value); } private void SetShaderBlinkIntensity(float newValue) { - ((ShaderMaterial)AnimatedSprite.MaterialOverride).SetShaderParameter("blink_intensity", newValue); + _shaderMaterial.SetShaderParameter("blink_intensity", newValue); } public void PlayShieldAnimation() { - + Blink(false); } } \ No newline at end of file diff --git a/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs b/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs new file mode 100644 index 00000000..4a8d4398 --- /dev/null +++ b/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs @@ -0,0 +1,75 @@ +using Cirno.Scripts.Components.Actors; +using Cirno.Scripts.Weapons; +using Godot; + +namespace Cirno.Scripts.Components.FSM._3DPlayer; + +public partial class PlayerGrazingModule3D : Area3D, IModule +{ + [Export] public BulletOwner Owner { get; private set; } = BulletOwner.Player; + + [Export] public ActorResourceProvider Shield { get; private set; } + + private bool _enabled = false; + + public IStateMachine StateMachine { get; private set; } + + public bool Enabled + { + get => _enabled; + set + { + if (_enabled == value) return; + _enabled = value; + } + } + + public void EnterState(PlayerState state) + { + Enabled = true; + this.AreaEntered += OnAreaEntered; + } + + private void OnAreaEntered(Area3D area) + { + if (!Enabled) return; + if (area is Bullet3D bullet) + { + if (!bullet.Enabled) return; + if (bullet.IsGrazed) return; + if (!bullet.BulletInfo.Grazeable) return; + if (bullet.BulletOwner is BulletOwner.Player) return; + + bullet.Graze(); + //bullet.IsGrazed = true; + var baseGrazeValue = bullet.BulletInfo.GrazeValue; + + float grazeShield = baseGrazeValue * GlobalState.Instance.SessionSettings.DifficultyDamageMultiplier; + + Shield.CurrentResource += grazeShield; + + // check if it's grazed + // check if it's grazeable + // restore appropriate amount of shield + } + } + + public virtual void Init(IStateMachine machine) + { + StateMachine = machine; + } + + public void ExitState(PlayerState state) + { + Enabled = false; + this.AreaEntered -= OnAreaEntered; + } + + public void Process(double delta) + { + } + + public void PhysicsProcess(double delta) + { + } +} \ No newline at end of file diff --git a/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs.uid b/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs.uid new file mode 100644 index 00000000..155b73a4 --- /dev/null +++ b/Scripts/Components/FSM/3DPlayer/PlayerGrazingModule3D.cs.uid @@ -0,0 +1 @@ +uid://pqsd8h60urrc diff --git a/Scripts/Weapons/Bullet3D.cs b/Scripts/Weapons/Bullet3D.cs index 866df771..2a1c5b0f 100644 --- a/Scripts/Weapons/Bullet3D.cs +++ b/Scripts/Weapons/Bullet3D.cs @@ -73,7 +73,7 @@ public partial class Bullet3D : Area3D, IBullet public override void _Ready() { - _grazeSound = GetNodeOrNull("AudioStreamPlayer"); + _grazeSound = GetNodeOrNull("GrazeSound"); _grazeParticles = GetNodeOrNull("GrazeParticles"); _collisionShape = GetNode("CollisionShape"); @@ -101,6 +101,9 @@ public partial class Bullet3D : Area3D, IBullet { sphere.Radius = bulletInfo.OriginalBulletResource.BulletSize; } + + IsGrazed = false; + IsFrozen = false; // Need to clone them here // _modifiers = _bulletInfo.TimeModifiers.Select(x => x.MakeClone()).ToList();