mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Modularized doors and lightbridges
This commit is contained in:
parent
1a24711984
commit
1a5bd1b6d8
27 changed files with 513 additions and 346 deletions
6
Resources/Materials/Static_Scanlines.tres
Normal file
6
Resources/Materials/Static_Scanlines.tres
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://cdaeormgf78de"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://cjdl1m3psohju" path="res://Shaders/scanlines_static.tres" id="1_hteyp"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_hteyp")
|
||||
|
|
@ -1,21 +1,13 @@
|
|||
[gd_scene load_steps=27 format=3 uid="uid://b0gpbkxdfbnjh"]
|
||||
[gd_scene load_steps=28 format=3 uid="uid://b0gpbkxdfbnjh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b2bpqbfeqi4ge" path="res://Scripts/Activables/ForceField.cs" id="1_yxhr6"]
|
||||
[ext_resource type="Script" uid="uid://dwry0643yvdiv" path="res://Scripts/Door.cs" id="1_3s51g"]
|
||||
[ext_resource type="Texture2D" uid="uid://gc24sjyj47x6" path="res://Sprites/Actors/ForceFieldHorizontal.png" id="2_12wxm"]
|
||||
[ext_resource type="Shader" uid="uid://0ruey5bjl7mh" path="res://Shaders/Blink.gdshader" id="2_q7pky"]
|
||||
[ext_resource type="Shader" uid="uid://cjdl1m3psohju" path="res://Shaders/scanlines_static.tres" id="2_qbobr"]
|
||||
[ext_resource type="Material" uid="uid://cdaeormgf78de" path="res://Resources/Materials/Static_Scanlines.tres" id="3_8cguw"]
|
||||
[ext_resource type="Script" uid="uid://cvsrm74jftau8" path="res://Scripts/Components/Actors/ForceFieldSpriteComponent.cs" id="5_3s51g"]
|
||||
[ext_resource type="AudioStream" uid="uid://ciuv2acfujlys" path="res://SFX/Artninja_Forcefield_Enable.wav" id="5_8cguw"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccxjo86nvcl54" path="res://SFX/Artninja_Forcefield_Disable.wav" id="6_3s51g"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fipgw"]
|
||||
shader = ExtResource("2_q7pky")
|
||||
shader_parameter/blink_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/blink_intensity = 0.0
|
||||
shader_parameter/teleport_progress = 0.0
|
||||
shader_parameter/scanline_density = 50.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yl7re"]
|
||||
shader = ExtResource("2_qbobr")
|
||||
[ext_resource type="Script" uid="uid://crpkvxepkcrir" path="res://Scripts/Components/Actors/ForceFieldCollisionDisabler.cs" id="6_sqafs"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gecst"]
|
||||
atlas = ExtResource("2_12wxm")
|
||||
|
|
@ -145,6 +137,13 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fipgw"]
|
||||
shader = ExtResource("2_q7pky")
|
||||
shader_parameter/blink_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/blink_intensity = 0.0
|
||||
shader_parameter/teleport_progress = 0.0
|
||||
shader_parameter/scanline_density = 50.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0wg11"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
|
|
@ -154,28 +153,33 @@ size = Vector2(32, 32)
|
|||
[node name="HorizontalForceField" type="Area2D" groups=["Solid"]]
|
||||
collision_layer = 64
|
||||
collision_mask = 154
|
||||
script = ExtResource("1_yxhr6")
|
||||
TurnOffMaterial = SubResource("ShaderMaterial_fipgw")
|
||||
ActiveMaterial = SubResource("ShaderMaterial_yl7re")
|
||||
script = ExtResource("1_3s51g")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
modulate = Color(1, 1, 1, 0.784314)
|
||||
sprite_frames = SubResource("SpriteFrames_h2s1d")
|
||||
animation = &"Closed"
|
||||
script = ExtResource("5_3s51g")
|
||||
TurnOffMaterial = SubResource("ShaderMaterial_fipgw")
|
||||
ActiveMaterial = ExtResource("3_8cguw")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." node_paths=PackedStringArray("_door")]
|
||||
visible = false
|
||||
shape = SubResource("RectangleShape2D_0wg11")
|
||||
script = ExtResource("6_sqafs")
|
||||
_door = NodePath("..")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
collision_layer = 64
|
||||
collision_mask = 10
|
||||
gravity_scale = 0.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D" node_paths=PackedStringArray("_door")]
|
||||
visible = false
|
||||
shape = SubResource("RectangleShape2D_f2rl6")
|
||||
script = ExtResource("6_sqafs")
|
||||
_door = NodePath("../..")
|
||||
|
||||
[node name="ActivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
position = Vector2(0, 1)
|
||||
|
|
@ -185,5 +189,3 @@ max_distance = 200.0
|
|||
[node name="DeactivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("6_3s51g")
|
||||
max_distance = 200.0
|
||||
|
||||
[connection signal="animation_changed" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_changed"]
|
||||
|
|
|
|||
70
Scenes/Actors/Lightbridge.tscn
Normal file
70
Scenes/Actors/Lightbridge.tscn
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://d0j1bmgbefyp2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwry0643yvdiv" path="res://Scripts/Door.cs" id="1_faieq"]
|
||||
[ext_resource type="Shader" uid="uid://0ruey5bjl7mh" path="res://Shaders/Blink.gdshader" id="2_25105"]
|
||||
[ext_resource type="Script" uid="uid://crpkvxepkcrir" path="res://Scripts/Components/Actors/ForceFieldCollisionDisabler.cs" id="3_hctcd"]
|
||||
[ext_resource type="Script" uid="uid://cwnfsmogt11mn" path="res://Scripts/Components/Actors/LightBridgeSpriteComponent.cs" id="3_hg05y"]
|
||||
[ext_resource type="Material" uid="uid://cdaeormgf78de" path="res://Resources/Materials/Static_Scanlines.tres" id="3_oo6b5"]
|
||||
[ext_resource type="AudioStream" uid="uid://ciuv2acfujlys" path="res://SFX/Artninja_Forcefield_Enable.wav" id="5_hwweb"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccxjo86nvcl54" path="res://SFX/Artninja_Forcefield_Disable.wav" id="6_v0863"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cub4j"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_hctcd"]
|
||||
gradient = SubResource("Gradient_cub4j")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_25105"]
|
||||
shader = ExtResource("2_25105")
|
||||
shader_parameter/blink_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/blink_intensity = 0.0
|
||||
shader_parameter/teleport_progress = 0.0
|
||||
shader_parameter/scanline_density = 50.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0wg11"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hctcd"]
|
||||
size = Vector2(21, 178)
|
||||
|
||||
[node name="LightBridge" type="Area2D" groups=["Solid"]]
|
||||
collision_layer = 64
|
||||
collision_mask = 154
|
||||
script = ExtResource("1_faieq")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.686275, 1, 1, 0.529412)
|
||||
material = ExtResource("3_oo6b5")
|
||||
position = Vector2(-4.76837e-07, 9.53674e-07)
|
||||
scale = Vector2(0.125, -32)
|
||||
texture = SubResource("GradientTexture1D_hctcd")
|
||||
script = ExtResource("3_hg05y")
|
||||
TurnOffMaterial = SubResource("ShaderMaterial_25105")
|
||||
ActiveMaterial = ExtResource("3_oo6b5")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." node_paths=PackedStringArray("_door")]
|
||||
visible = false
|
||||
shape = SubResource("RectangleShape2D_0wg11")
|
||||
script = ExtResource("3_hctcd")
|
||||
_door = NodePath("..")
|
||||
|
||||
[node name="ActivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
position = Vector2(0, 1)
|
||||
stream = ExtResource("5_hwweb")
|
||||
max_distance = 200.0
|
||||
|
||||
[node name="DeactivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("6_v0863")
|
||||
max_distance = 200.0
|
||||
|
||||
[node name="AcidArea" type="Area2D" parent="." groups=["Acid"]]
|
||||
collision_layer = 256
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="AcidArea" node_paths=PackedStringArray("_door")]
|
||||
position = Vector2(-0.5, 0)
|
||||
shape = SubResource("RectangleShape2D_hctcd")
|
||||
script = ExtResource("3_hctcd")
|
||||
_door = NodePath("../..")
|
||||
Invert = true
|
||||
|
|
@ -219,7 +219,7 @@ sprite_frames = SubResource("SpriteFrames_5qlss")
|
|||
|
||||
[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("_healthProvider", "_shieldProvider")]
|
||||
collision_layer = 2
|
||||
collision_mask = 136
|
||||
collision_mask = 392
|
||||
script = ExtResource("14_igu66")
|
||||
_healthProvider = NodePath("HealthProvider")
|
||||
_shieldProvider = NodePath("ShieldProvider")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
[gd_scene load_steps=24 format=3 uid="uid://l84on3kv2s52"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://l84on3kv2s52"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwry0643yvdiv" path="res://Scripts/Door.cs" id="1_emfh4"]
|
||||
[ext_resource type="Texture2D" uid="uid://d4ialp36plt7v" path="res://Sprites/Actors/Doors/horizontal_door_1.png" id="2_2h3ih"]
|
||||
[ext_resource type="Texture2D" uid="uid://desg0e2phtw50" path="res://Sprites/HorizontalDoor.png" id="2_rnx3o"]
|
||||
[ext_resource type="Script" uid="uid://bbuhaam28lwld" path="res://Scripts/Components/Actors/DoorSpriteComponent.cs" id="3_spifk"]
|
||||
[ext_resource type="AudioStream" uid="uid://dmsnvo8kdjyt8" path="res://SFX/517603__gurkboll__sony_dat_tcd-d10_pro_door_close.wav" id="4_4t32u"]
|
||||
[ext_resource type="Script" uid="uid://crpkvxepkcrir" path="res://Scripts/Components/Actors/ForceFieldCollisionDisabler.cs" id="4_nw4l4"]
|
||||
[ext_resource type="AudioStream" uid="uid://p5n7ijw2qvxy" path="res://SFX/517603__gurkboll__sony_dat_tcd-d10_pro_door_open.wav" id="5_spifk"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2qgx7"]
|
||||
|
|
@ -155,19 +157,24 @@ metadata/_edit_group_ = true
|
|||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_keeml")
|
||||
animation = &"Closed"
|
||||
script = ExtResource("3_spifk")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." node_paths=PackedStringArray("_door")]
|
||||
visible = false
|
||||
shape = SubResource("RectangleShape2D_0wg11")
|
||||
script = ExtResource("4_nw4l4")
|
||||
_door = NodePath("..")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
collision_layer = 64
|
||||
collision_mask = 10
|
||||
gravity_scale = 0.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D" node_paths=PackedStringArray("_door")]
|
||||
visible = false
|
||||
shape = SubResource("RectangleShape2D_f2rl6")
|
||||
script = ExtResource("4_nw4l4")
|
||||
_door = NodePath("../..")
|
||||
|
||||
[node name="DoorFrame" type="AnimatedSprite2D" parent="."]
|
||||
z_index = 1
|
||||
|
|
@ -181,5 +188,3 @@ max_distance = 200.0
|
|||
[node name="DeactivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("5_spifk")
|
||||
max_distance = 200.0
|
||||
|
||||
[connection signal="animation_changed" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_changed"]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
[gd_scene load_steps=18 format=3 uid="uid://bc64lr3vlwchq"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://bc64lr3vlwchq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwry0643yvdiv" path="res://Scripts/Door.cs" id="1_e61bg"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwcjixrhq4cdv" path="res://Sprites/DoorVertical.png" id="1_vdvtb"]
|
||||
[ext_resource type="Script" uid="uid://bbuhaam28lwld" path="res://Scripts/Components/Actors/DoorSpriteComponent.cs" id="3_076sv"]
|
||||
[ext_resource type="AudioStream" uid="uid://dmsnvo8kdjyt8" path="res://SFX/517603__gurkboll__sony_dat_tcd-d10_pro_door_close.wav" id="3_gt5vd"]
|
||||
[ext_resource type="AudioStream" uid="uid://p5n7ijw2qvxy" path="res://SFX/517603__gurkboll__sony_dat_tcd-d10_pro_door_open.wav" id="4_076sv"]
|
||||
[ext_resource type="Script" uid="uid://crpkvxepkcrir" path="res://Scripts/Components/Actors/ForceFieldCollisionDisabler.cs" id="4_vbd6u"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mbysk"]
|
||||
atlas = ExtResource("1_vdvtb")
|
||||
|
|
@ -113,17 +115,22 @@ metadata/_edit_group_ = true
|
|||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_keeml")
|
||||
animation = &"Closing"
|
||||
script = ExtResource("3_076sv")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." node_paths=PackedStringArray("_door")]
|
||||
shape = SubResource("RectangleShape2D_0wg11")
|
||||
script = ExtResource("4_vbd6u")
|
||||
_door = NodePath("..")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
collision_layer = 64
|
||||
collision_mask = 10
|
||||
gravity_scale = 0.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D" node_paths=PackedStringArray("_door")]
|
||||
shape = SubResource("RectangleShape2D_f2rl6")
|
||||
script = ExtResource("4_vbd6u")
|
||||
_door = NodePath("../..")
|
||||
|
||||
[node name="ActivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
position = Vector2(0, 1)
|
||||
|
|
@ -133,5 +140,3 @@ max_distance = 200.0
|
|||
[node name="DeactivationSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("4_076sv")
|
||||
max_distance = 200.0
|
||||
|
||||
[connection signal="animation_changed" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_changed"]
|
||||
|
|
|
|||
19
Scenes/Interactable/control_pad_green_keycard.tscn
Normal file
19
Scenes/Interactable/control_pad_green_keycard.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://drdgcu2r3yrp7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://duhodrhcnoslh" path="res://Scripts/Interactables/Switch.cs" id="1_kb2ks"]
|
||||
[ext_resource type="Resource" uid="uid://cspcgkr0tane2" path="res://Resources/Items/Green_Keycard.tres" id="2_kb2ks"]
|
||||
[ext_resource type="Texture2D" uid="uid://cpaigf41fqxr5" path="res://Sprites/Actors/Green_Card_Reader.png" id="3_6ogyc"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vvpve"]
|
||||
|
||||
[node name="KeycardReaderGreen" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_kb2ks")
|
||||
Requirements = [ExtResource("2_kb2ks")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_vvpve")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("3_6ogyc")
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://r25rq6ijgm6m"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://r25rq6ijgm6m"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Items/Red_Keycard.tscn" id="1_o26qb"]
|
||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_kb5vg"]
|
||||
[ext_resource type="Resource" uid="uid://cspcgkr0tane2" path="res://Resources/Items/Green_Keycard.tres" id="2_kb5vg"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvkjnc3ggp7ba" path="res://Sprites/Items/GreenKeycard_Small.png" id="2_lts72"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3c71u"]
|
||||
atlas = ExtResource("2_lts72")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
|
@ -25,7 +28,14 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="GreenKeyCard" instance=ExtResource("1_o26qb")]
|
||||
[node name="GreenKeyCard" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_kb5vg")
|
||||
LootTable = [ExtResource("2_kb5vg")]
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_6vv2s")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_y8q6b")
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
336
Scenes/test.tscn
336
Scenes/test.tscn
File diff suppressed because one or more lines are too long
|
|
@ -17,7 +17,7 @@ public partial class ForceField : Door
|
|||
base.Open();
|
||||
if (TurnOffMaterial is null) return;
|
||||
|
||||
_animatedSprite.Material = TurnOffMaterial;
|
||||
//_animatedSprite.Material = TurnOffMaterial;
|
||||
//((ShaderMaterial)_animatedSprite.Material).Shader = TurnOffShader;
|
||||
_ = AnimateShutdownAsync();
|
||||
}
|
||||
|
|
@ -37,17 +37,17 @@ public partial class ForceField : Door
|
|||
base.Close();
|
||||
|
||||
if (ActiveMaterial is null) return;
|
||||
_animatedSprite.Material = ActiveMaterial;
|
||||
//_animatedSprite.Material = ActiveMaterial;
|
||||
//((ShaderMaterial)_animatedSprite.Material).Shader = ActiveShader;
|
||||
}
|
||||
|
||||
private void SetShaderTeleportProgress(float value)
|
||||
{
|
||||
((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("teleport_progress", value);
|
||||
//((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("teleport_progress", value);
|
||||
}
|
||||
|
||||
private void SetShaderScanlineDensity(float value)
|
||||
{
|
||||
((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("scanline_density", value);
|
||||
//((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("scanline_density", value);
|
||||
}
|
||||
}
|
||||
1
Scripts/Activables/LightBridge.cs.uid
Normal file
1
Scripts/Activables/LightBridge.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dgienjn07p5mt
|
||||
29
Scripts/Components/Actors/DoorSpriteComponent.cs
Normal file
29
Scripts/Components/Actors/DoorSpriteComponent.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class DoorSpriteComponent : AnimatedSprite2D
|
||||
{
|
||||
protected Door _door;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
_door = GetParent<Door>();
|
||||
|
||||
_door.DoorOpened += DoorOpened;
|
||||
_door.DoorClosed += DoorClosed;
|
||||
}
|
||||
|
||||
protected virtual void DoorClosed()
|
||||
{
|
||||
this.Play("Closing");
|
||||
}
|
||||
|
||||
protected virtual void DoorOpened()
|
||||
{
|
||||
this.Play("Opening");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1
Scripts/Components/Actors/DoorSpriteComponent.cs.uid
Normal file
1
Scripts/Components/Actors/DoorSpriteComponent.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bbuhaam28lwld
|
||||
39
Scripts/Components/Actors/ForceFieldCollisionDisabler.cs
Normal file
39
Scripts/Components/Actors/ForceFieldCollisionDisabler.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class ForceFieldCollisionDisabler : CollisionShape2D
|
||||
{
|
||||
[Export]
|
||||
protected Door _door;
|
||||
|
||||
[Export]
|
||||
public bool Invert { get; private set; } = false;
|
||||
public override void _Ready()
|
||||
{
|
||||
//_door = GetParent<Door>();
|
||||
|
||||
_door.DoorOpened += DoorOpened;
|
||||
_door.DoorClosed += DoorClosed;
|
||||
}
|
||||
|
||||
protected virtual void DoorClosed()
|
||||
{
|
||||
CallDeferred(MethodName.Enable);
|
||||
}
|
||||
|
||||
private void Disable()
|
||||
{
|
||||
this.Disabled = !Invert;
|
||||
}
|
||||
|
||||
protected virtual void DoorOpened()
|
||||
{
|
||||
CallDeferred(MethodName.Disable);
|
||||
}
|
||||
|
||||
private void Enable()
|
||||
{
|
||||
this.Disabled = Invert;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://crpkvxepkcrir
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class ForceFieldMaterialAnimationHandler : Node2D
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dmi8k8ogkwogi
|
||||
48
Scripts/Components/Actors/ForceFieldSpriteComponent.cs
Normal file
48
Scripts/Components/Actors/ForceFieldSpriteComponent.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class ForceFieldSpriteComponent : DoorSpriteComponent
|
||||
{
|
||||
[Export]
|
||||
public Material TurnOffMaterial { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Material ActiveMaterial { get; private set; }
|
||||
|
||||
protected override void DoorOpened()
|
||||
{
|
||||
base.DoorOpened();
|
||||
if (TurnOffMaterial is null) return;
|
||||
|
||||
this.Material = TurnOffMaterial;
|
||||
_ = AnimateShutdownAsync();
|
||||
}
|
||||
|
||||
protected override void DoorClosed()
|
||||
{
|
||||
base.DoorClosed();
|
||||
if (ActiveMaterial is null) return;
|
||||
this.Material = ActiveMaterial;
|
||||
}
|
||||
|
||||
protected async Task AnimateShutdownAsync()
|
||||
{
|
||||
Tween tween = GetTree().CreateTween();
|
||||
tween.TweenMethod(Callable.From((float value) => SetShaderScanlineDensity(value)), 0f, 50f, 0.5);
|
||||
tween.Parallel().TweenMethod(Callable.From((float value) => SetShaderTeleportProgress(value)), 0f, 1f, 0.5);
|
||||
|
||||
await ToSignal(tween, "finished");
|
||||
}
|
||||
|
||||
private void SetShaderTeleportProgress(float value)
|
||||
{
|
||||
((ShaderMaterial)this.Material).SetShaderParameter("teleport_progress", value);
|
||||
}
|
||||
|
||||
private void SetShaderScanlineDensity(float value)
|
||||
{
|
||||
((ShaderMaterial)this.Material).SetShaderParameter("scanline_density", value);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://cvsrm74jftau8
|
||||
57
Scripts/Components/Actors/LightBridgeSpriteComponent.cs
Normal file
57
Scripts/Components/Actors/LightBridgeSpriteComponent.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class LightBridgeSpriteComponent : Sprite2D
|
||||
{
|
||||
[Export]
|
||||
public Material TurnOffMaterial { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Material ActiveMaterial { get; private set; }
|
||||
|
||||
protected Door _door;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
_door = GetParent<Door>();
|
||||
|
||||
_door.DoorOpened += DoorOpened;
|
||||
_door.DoorClosed += DoorClosed;
|
||||
}
|
||||
|
||||
protected virtual void DoorOpened()
|
||||
{
|
||||
if (TurnOffMaterial is null) return;
|
||||
|
||||
this.Material = TurnOffMaterial;
|
||||
_ = AnimateShutdownAsync();
|
||||
}
|
||||
|
||||
protected virtual void DoorClosed()
|
||||
{
|
||||
if (ActiveMaterial is null) return;
|
||||
this.Material = ActiveMaterial;
|
||||
}
|
||||
|
||||
protected async Task AnimateShutdownAsync()
|
||||
{
|
||||
Tween tween = GetTree().CreateTween();
|
||||
tween.TweenMethod(Callable.From((float value) => SetShaderScanlineDensity(value)), 0f, 50f, 0.5);
|
||||
tween.Parallel().TweenMethod(Callable.From((float value) => SetShaderTeleportProgress(value)), 0f, 1f, 0.5);
|
||||
|
||||
await ToSignal(tween, "finished");
|
||||
}
|
||||
|
||||
private void SetShaderTeleportProgress(float value)
|
||||
{
|
||||
((ShaderMaterial)this.Material).SetShaderParameter("teleport_progress", value);
|
||||
}
|
||||
|
||||
private void SetShaderScanlineDensity(float value)
|
||||
{
|
||||
((ShaderMaterial)this.Material).SetShaderParameter("scanline_density", value);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://cwnfsmogt11mn
|
||||
|
|
@ -15,6 +15,8 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
private ActorResourceProvider _healthProvider;
|
||||
[Export]
|
||||
private ActorResourceProvider _shieldProvider;
|
||||
|
||||
[Export] public StringName AcidGroupName { get; private set; } = "Acid";
|
||||
|
||||
[Signal]
|
||||
public delegate void HealthChangedEventHandler(float newValue, float maxValue);
|
||||
|
|
@ -88,10 +90,23 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
{
|
||||
if (!Enabled) return;
|
||||
if (Invulnerable) return;
|
||||
if (area.IsInGroup(AcidGroupName))
|
||||
{
|
||||
// Handle acid death
|
||||
AcidDeath();
|
||||
return;
|
||||
}
|
||||
if (area is not Bullet bullet || bullet.BulletOwner == BulletGroup) return;
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
bullet.RequestCollisionDestruction();
|
||||
}
|
||||
|
||||
private void AcidDeath()
|
||||
{
|
||||
if (!Enabled) return;
|
||||
GD.Print("Acid death");
|
||||
_healthProvider.CurrentResource = 0;
|
||||
}
|
||||
|
||||
public void Hit(float damage, DamageType type = DamageType.Neutral)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ using Cirno.Scripts;
|
|||
|
||||
public partial class Door : Activable
|
||||
{
|
||||
protected AnimatedSprite2D _animatedSprite;
|
||||
protected CollisionShape2D _collisionShape;
|
||||
protected CollisionShape2D _solidShape;
|
||||
// protected AnimatedSprite2D _animatedSprite;
|
||||
//protected CollisionShape2D _collisionShape;
|
||||
//protected CollisionShape2D _solidShape;
|
||||
|
||||
protected AudioStreamPlayer2D _activationSound;
|
||||
protected AudioStreamPlayer2D _deactivationSound;
|
||||
|
|
@ -21,12 +21,15 @@ public partial class Door : Activable
|
|||
|
||||
[Signal]
|
||||
public delegate void DoorClosedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void DestroyedEventHandler();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||
_collisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
_solidShape = GetNode<CollisionShape2D>("RigidBody2D/CollisionShape2D");
|
||||
// _animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||
//_collisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
//_solidShape = GetNode<CollisionShape2D>("RigidBody2D/CollisionShape2D");
|
||||
|
||||
_activationSound = GetNodeOrNull<AudioStreamPlayer2D>("ActivationSound");
|
||||
_deactivationSound = GetNodeOrNull<AudioStreamPlayer2D>("DeactivationSound");
|
||||
|
|
@ -41,35 +44,39 @@ public partial class Door : Activable
|
|||
|
||||
public virtual void Open()
|
||||
{
|
||||
_animatedSprite.Play("Opening");
|
||||
// _animatedSprite.Play("Opening");
|
||||
State = DoorState.Open;
|
||||
CallDeferred(MethodName.DeferredDisableCollision, true);
|
||||
_deactivationSound?.Play();
|
||||
EmitSignal(SignalName.DoorOpened);
|
||||
//_collisionShape.Disabled = true;
|
||||
//_solidShape.Disabled = true;
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
_animatedSprite.Play("Closing");
|
||||
// _animatedSprite.Play("Closing");
|
||||
State = DoorState.Closed;
|
||||
CallDeferred(MethodName.DeferredDisableCollision, false);
|
||||
_activationSound?.Play();
|
||||
EmitSignal(SignalName.DoorClosed);
|
||||
//_collisionShape.Disabled = false;
|
||||
//_solidShape.Disabled = false;
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
_animatedSprite.Play("Destroyed");
|
||||
// _animatedSprite.Play("Destroyed");
|
||||
|
||||
State = DoorState.Destroyed;
|
||||
CallDeferred(MethodName.DeferredDisableCollision, true);
|
||||
EmitSignal(SignalName.Destroyed);
|
||||
}
|
||||
|
||||
private void DeferredDisableCollision(bool state)
|
||||
{
|
||||
_collisionShape.Disabled = state;
|
||||
_solidShape.Disabled = state;
|
||||
//_collisionShape.Disabled = state;
|
||||
//_solidShape.Disabled = state;
|
||||
}
|
||||
|
||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
|
|
@ -136,20 +143,20 @@ public partial class Door : Activable
|
|||
}
|
||||
}
|
||||
|
||||
public void _on_animated_sprite_2d_animation_changed()
|
||||
{
|
||||
switch (_animatedSprite.Animation)
|
||||
{
|
||||
case "Opening":
|
||||
|
||||
break;
|
||||
case "Closing":
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// public void _on_animated_sprite_2d_animation_changed()
|
||||
// {
|
||||
// switch (_animatedSprite.Animation)
|
||||
// {
|
||||
// case "Opening":
|
||||
//
|
||||
// break;
|
||||
// case "Closing":
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public enum DoorState
|
||||
|
|
|
|||
6
Scripts/ShaderTools.cs
Normal file
6
Scripts/ShaderTools.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
namespace Cirno.Scripts;
|
||||
|
||||
public static class ShaderTools
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ source = 5
|
|||
input_name = "time"
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
code = "shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ enabled=PackedStringArray("res://addons/DebugGUI/plugin.cfg", "res://addons/dial
|
|||
|
||||
Interactable=""
|
||||
Solid=""
|
||||
Acid=""
|
||||
|
||||
[input]
|
||||
|
||||
|
|
@ -271,6 +272,7 @@ inventory={
|
|||
2d_physics/layer_6="shoot-through"
|
||||
2d_physics/layer_7="solid-actors"
|
||||
2d_physics/layer_8="EnemyBullets"
|
||||
2d_physics/layer_9="Acid"
|
||||
|
||||
[physics]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue