mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Alert Signs
This commit is contained in:
parent
d3634a3dd2
commit
5452b36f32
13 changed files with 226 additions and 22 deletions
59
Scenes/Actors/alarm_sign.tscn
Normal file
59
Scenes/Actors/alarm_sign.tscn
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://dnbtou2fklyvp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Activables/ScriptableBase.cs" id="1_kao8y"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/Events/AlarmDisableEvent.cs" id="2_8fwyu"]
|
||||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="3_eg1gw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bodoftbnvjh6i" path="res://Sprites/Actors/AlertSign.png" id="4_7ysp5"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/AlarmSpriteSwitcher.cs" id="5_qohod"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_hppa0"]
|
||||
script = ExtResource("2_8fwyu")
|
||||
WaitForCompletion = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_adk1y"]
|
||||
atlas = ExtResource("4_7ysp5")
|
||||
region = Rect2(16, 0, 16, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jdxjv"]
|
||||
atlas = ExtResource("4_7ysp5")
|
||||
region = Rect2(32, 0, 16, 8)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jkso3"]
|
||||
atlas = ExtResource("4_7ysp5")
|
||||
region = Rect2(0, 0, 16, 8)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_25o7d"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_adk1y")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jdxjv")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"alarmed",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jkso3")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="AlarmBox" type="Node2D"]
|
||||
script = ExtResource("1_kao8y")
|
||||
Events = Array[Object]([SubResource("Resource_hppa0")])
|
||||
|
||||
[node name="ControlPad" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_eg1gw")]
|
||||
Target = NodePath("..")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_25o7d")
|
||||
|
||||
[node name="SpriteSwitcher" type="Node2D" parent="." node_paths=PackedStringArray("_sprite")]
|
||||
script = ExtResource("5_qohod")
|
||||
_sprite = NodePath("../AnimatedSprite2D")
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://d1h48wgasakk4"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://d1h48wgasakk4"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Interactables/AlarmBox.cs" id="1_usvoy"]
|
||||
[ext_resource type="Script" path="res://Scripts/Activables/ScriptableBase.cs" id="1_2d4he"]
|
||||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="2_2xddf"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpc66amnvvkrn" path="res://Sprites/AlarmBox.png" id="2_slydm"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/Events/AlarmDisableEvent.cs" id="2_umsjn"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/AlarmSpriteSwitcher.cs" id="5_7g2v5"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vvpve"]
|
||||
[sub_resource type="Resource" id="Resource_hppa0"]
|
||||
script = ExtResource("2_umsjn")
|
||||
WaitForCompletion = true
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uh6p2"]
|
||||
atlas = ExtResource("2_slydm")
|
||||
|
|
@ -39,15 +44,18 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="AlarmBox" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_usvoy")
|
||||
[node name="AlarmBox" type="Node2D" groups=["Interactable"]]
|
||||
script = ExtResource("1_2d4he")
|
||||
Events = Array[Object]([SubResource("Resource_hppa0")])
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_vvpve")
|
||||
[node name="ControlPad" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("2_2xddf")]
|
||||
Target = NodePath("..")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_kbgi5")
|
||||
animation = &"alarmed"
|
||||
frame_progress = 0.613245
|
||||
|
||||
[node name="SpriteSwitcher" type="Node2D" parent="." node_paths=PackedStringArray("_sprite")]
|
||||
script = ExtResource("5_7g2v5")
|
||||
_sprite = NodePath("../AnimatedSprite2D")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=64 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=65 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
|
|
@ -47,6 +47,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://byjq8xpx4crfd" path="res://Scenes/Interactable/control_pad_blue_keycard.tscn" id="35_gdbcj"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0yes7huiyisw" path="res://Scenes/Items/Blue_Keycard.tscn" id="35_rblsn"]
|
||||
[ext_resource type="PackedScene" uid="uid://r25rq6ijgm6m" path="res://Scenes/Items/Green_Keycard.tscn" id="36_f8fh1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnbtou2fklyvp" path="res://Scenes/Actors/alarm_sign.tscn" id="36_rd6f6"]
|
||||
[ext_resource type="Script" path="res://Scripts/Activables/ScriptableBase.cs" id="42_wigyb"]
|
||||
[ext_resource type="PackedScene" uid="uid://fxvlaidieiv7" path="res://Scenes/Interactable/ScriptableAreaTrigger.tscn" id="43_kf3qc"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/Events/MovePlayerEvent.cs" id="44_klwgh"]
|
||||
|
|
@ -275,9 +276,6 @@ Target = NodePath("../HorizontalDoor")
|
|||
[node name="AlarmBox" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
|
||||
position = Vector2(-713, -153)
|
||||
|
||||
[node name="AlarmBox2" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
|
||||
position = Vector2(-616, -153)
|
||||
|
||||
[node name="Turret" parent="Factory Tilemaps" instance=ExtResource("18_6y85f")]
|
||||
position = Vector2(-1076, 125)
|
||||
|
||||
|
|
@ -329,6 +327,24 @@ position = Vector2(-710, -459)
|
|||
position = Vector2(-1515, -319)
|
||||
Target = NodePath("../HorizontalDoor3")
|
||||
|
||||
[node name="AlarmBox2" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-714, -171)
|
||||
|
||||
[node name="AlarmBox3" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-888, 153)
|
||||
|
||||
[node name="AlarmBox4" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-1173, 119)
|
||||
|
||||
[node name="AlarmBox5" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-1081, -22)
|
||||
|
||||
[node name="AlarmBox6" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-1506, -202)
|
||||
|
||||
[node name="AlarmBox7" parent="Factory Tilemaps" instance=ExtResource("36_rd6f6")]
|
||||
position = Vector2(-1019, 151)
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
script = ExtResource("6_t8ide")
|
||||
pixel_snap = false
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ public partial class ScriptableBase : Node2D, IActivable
|
|||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
foreach (var item in Events)
|
||||
{
|
||||
item.Init(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
|
|
|||
35
Scripts/Components/AlarmSpriteSwitcher.cs
Normal file
35
Scripts/Components/AlarmSpriteSwitcher.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components;
|
||||
|
||||
public partial class AlarmSpriteSwitcher : Node2D
|
||||
{
|
||||
private AlarmManager _alarmManager;
|
||||
[Export]
|
||||
private AnimatedSprite2D _sprite;
|
||||
|
||||
[Export]
|
||||
private string _inactiveAnimationName = "default";
|
||||
|
||||
[Export]
|
||||
private string _activeAnimationName = "alarmed";
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_alarmManager = this.GetAlarmManager();
|
||||
|
||||
_alarmManager.AlarmEnabled += AlarmManagerOnAlarmEnabled;
|
||||
_alarmManager.AlarmDisabled += AlarmManagerOnAlarmDisabled;
|
||||
}
|
||||
|
||||
private void AlarmManagerOnAlarmDisabled()
|
||||
{
|
||||
_sprite.Play(_inactiveAnimationName);
|
||||
}
|
||||
|
||||
private void AlarmManagerOnAlarmEnabled(Vector2 location)
|
||||
{
|
||||
_sprite.Play(_activeAnimationName);
|
||||
}
|
||||
}
|
||||
|
|
@ -37,9 +37,14 @@ public partial class ActivateEvent : EventResource
|
|||
return true;
|
||||
}
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
{
|
||||
|
||||
ActivateTargets();
|
||||
_isComplete = true;
|
||||
}
|
||||
|
|
|
|||
32
Scripts/Resources/Events/AlarmDisableEvent.cs
Normal file
32
Scripts/Resources/Events/AlarmDisableEvent.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Events;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class AlarmDisableEvent : EventResource
|
||||
{
|
||||
private bool _isComplete = false;
|
||||
private AlarmManager _alarmManager;
|
||||
|
||||
public override bool IsComplete()
|
||||
{
|
||||
return _isComplete;
|
||||
}
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_alarmManager = parent.GetAlarmManager();
|
||||
}
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
{
|
||||
_alarmManager.DisableAlarm();
|
||||
_isComplete = true;
|
||||
}
|
||||
|
||||
public override void UpdateEvent(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -9,13 +9,15 @@ public partial class DialogueStartEvent : EventResource
|
|||
private Node _dialogic;
|
||||
private GameManager _gameManager;
|
||||
private bool _isComplete = false;
|
||||
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_gameManager = parent.GetGameManager();
|
||||
_dialogic = parent.GetNode("/root/Dialogic");
|
||||
}
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
{
|
||||
_gameManager = parent.GetGameManager();
|
||||
|
||||
_dialogic = parent.GetNode("/root/Dialogic");
|
||||
|
||||
_gameManager.ChangeState(GameState.Dialogue);
|
||||
|
||||
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Cirno.Scripts.Resources.Events;
|
|||
public abstract partial class EventResource : Resource
|
||||
{
|
||||
[Export] public bool WaitForCompletion = true;
|
||||
public abstract void Init(Node2D parent);
|
||||
public abstract void Start(Node2D parent);
|
||||
public abstract void UpdateEvent(double delta);
|
||||
public abstract bool IsComplete();
|
||||
|
|
|
|||
|
|
@ -22,11 +22,14 @@ public partial class MovePlayerEvent : EventResource
|
|||
|
||||
private GameManager _gameManager;
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_gameManager = parent.GetGameManager();
|
||||
}
|
||||
|
||||
public override void Start(Node2D parentNode)
|
||||
{
|
||||
_gameManager = parentNode.GetGameManager();
|
||||
_isComplete = false;
|
||||
|
||||
_ = MovePlayer();
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
Sprites/Actors/AlertSign.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/AlertSign.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Actors/AlertSign.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/AlertSign.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/AlertSign.png.import
Normal file
34
Sprites/Actors/AlertSign.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bodoftbnvjh6i"
|
||||
path="res://.godot/imported/AlertSign.png-3a6b9ff328968d5f0b6a8b7179b1a89f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/AlertSign.png"
|
||||
dest_files=["res://.godot/imported/AlertSign.png-3a6b9ff328968d5f0b6a8b7179b1a89f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue