diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 23d3b646..212e38ee 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=90 format=4 uid="uid://bv451a8wgty4u"] +[gd_scene load_steps=89 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"] @@ -73,8 +73,7 @@ [ext_resource type="PackedScene" uid="uid://bc054js8ep2b" path="res://Scenes/Actors/FairyGuard_New.tscn" id="73_cfpaq"] [ext_resource type="PackedScene" uid="uid://bdvj4cxnyr3w4" path="res://Scenes/Actors/Thermathron.tscn" id="73_ier4h"] [ext_resource type="PackedScene" uid="uid://dfat0erkvb513" path="res://Scenes/Actors/Fairy_New.tscn" id="73_s4x1s"] -[ext_resource type="Texture2D" uid="uid://m32iqs21np0v" path="res://Sprites/BlackPixel.png" id="74_ra850"] -[ext_resource type="Script" path="res://Scripts/Activables/BlackCover.cs" id="75_jy7lo"] +[ext_resource type="PackedScene" uid="uid://c21m7w5ahpsd0" path="res://Scenes/Activable/Shroud.tscn" id="74_oaf68"] [sub_resource type="Resource" id="Resource_6sau4"] script = ExtResource("7_l32kg") @@ -197,10 +196,12 @@ metadata/_edit_lock_ = true [node name="HiddenProps" type="Node2D" parent="Factory Tilemaps"] metadata/_edit_lock_ = true -[node name="ControlPad5" parent="Factory Tilemaps/HiddenProps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")] +[node name="ControlPad5" parent="Factory Tilemaps/HiddenProps" node_paths=PackedStringArray("Target", "Targets") instance=ExtResource("12_hfkf1")] y_sort_enabled = true position = Vector2(-968, 162) Target = NodePath("../../HorizontalDoor2") +Targets = [NodePath("../../../Shroud")] +ActivationType = 5 [node name="Debug Room" type="Node2D" parent="Factory Tilemaps"] metadata/_edit_lock_ = true @@ -333,13 +334,13 @@ Target = NodePath("../Door_vertical") position = Vector2(-1064, 165) Target = NodePath("../Door_vertical") -[node name="ControlPad2" parent="Factory Tilemaps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")] +[node name="ControlPad2" parent="Factory Tilemaps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")] position = Vector2(-824, 165) -Target = NodePath("../Door_vertical2") +Targets = [NodePath("../Door_vertical2")] -[node name="ControlPad4" parent="Factory Tilemaps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")] +[node name="ControlPad4" parent="Factory Tilemaps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")] position = Vector2(-856, 167) -Target = NodePath("../Door_vertical2") +Targets = [NodePath("../Door_vertical2")] [node name="Door_vertical" parent="Factory Tilemaps" instance=ExtResource("15_mgtvp")] position = Vector2(-1048, 184) @@ -535,6 +536,15 @@ Target = NodePath("../Debug Room/HorizontalForceField") [node name="VerticalDoor" parent="Factory Tilemaps" instance=ExtResource("15_mgtvp")] position = Vector2(-1452, -247) +[node name="Teleporter10" parent="Factory Tilemaps" node_paths=PackedStringArray("Target") instance=ExtResource("30_8fdby")] +position = Vector2(-815, -343) +IsEnabled = true +Target = NodePath("../DebugTeleporter") + +[node name="DebugTeleporter" parent="Factory Tilemaps" instance=ExtResource("30_8fdby")] +position = Vector2(-801, 171) +Invisible = true + [node name="CameraController" type="Camera2D" parent="."] script = ExtResource("6_t8ide") pixel_snap = false @@ -752,10 +762,4 @@ position = Vector2(-1010, 203) position = Vector2(-581, -346) StartingAiState = 1 -[node name="Shroud" type="Sprite2D" parent="."] -visible = false -z_index = 1 -position = Vector2(-920.5, 78.75) -scale = Vector2(127, 126.5) -texture = ExtResource("74_ra850") -script = ExtResource("75_jy7lo") +[node name="Shroud" parent="." instance=ExtResource("74_oaf68")] diff --git a/Scripts/Activables/BlackCover.cs b/Scripts/Activables/BlackCover.cs index 47c7ddc2..93cc08fe 100644 --- a/Scripts/Activables/BlackCover.cs +++ b/Scripts/Activables/BlackCover.cs @@ -13,6 +13,7 @@ public partial class BlackCover : Sprite2D, IActivable public override void _Ready() { _activated = StartActive; + UpdateSprite(); } public void Activate(ActivationType activationType = ActivationType.Toggle) diff --git a/Scripts/Interactables/Switch.cs b/Scripts/Interactables/Switch.cs index 8ff92ddc..29a1eb9e 100644 --- a/Scripts/Interactables/Switch.cs +++ b/Scripts/Interactables/Switch.cs @@ -1,20 +1,29 @@ -using Godot; +using System.Linq; +using Godot; +using Godot.Collections; namespace Cirno.Scripts.Interactables; public partial class Switch : Interactable { [Export] public Node2D Target { get; set; } + [Export] public Array Targets { get; private set; } = new Array(); [Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle; public override bool Activate() { - if (MeetsRequirements() && Target is IActivable activable) - { - activable?.Activate(ActivationType); - return true; - } + if (!MeetsRequirements()) return false; + // Compatibility for old single system + bool success = ActivateTarget(Target); + + return Targets.Aggregate(success, (current, target) => ActivateTarget(target) | success); + } + + private bool ActivateTarget(Node2D target) + { + if (target is not IActivable activable) return false; + activable?.Activate(ActivationType); + return true; - return false; } } \ No newline at end of file