mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 08:05:55 +00:00
Keycards fix
This commit is contained in:
parent
2be069eab4
commit
91fcd73688
7 changed files with 46 additions and 16 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=39 format=3 uid="uid://c4pr2707hbeph"]
|
||||
[gd_scene load_steps=41 format=3 uid="uid://c4pr2707hbeph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="1_mpmil"]
|
||||
[ext_resource type="Script" uid="uid://chwqogny2v8t1" path="res://Scripts/Components/FSM/Player/Init.cs" id="2_i6wc8"]
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
[ext_resource type="Script" uid="uid://dv205x8msohpv" path="res://Scripts/Components/Actors/ActivationProvider.cs" id="22_12cwd"]
|
||||
[ext_resource type="PackedScene" uid="uid://chkpk7erlqajg" path="res://Scenes/Selector.tscn" id="23_5tmtw"]
|
||||
[ext_resource type="AudioStream" uid="uid://myr6n2c1u503" path="res://SFX/581602__samsterbirdies__beep-error.mp3" id="24_5tmtw"]
|
||||
[ext_resource type="Script" uid="uid://cem7a1agaqtrt" path="res://Scenes/InteractionController.cs" id="27_vwjki"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_b3hxm"]
|
||||
radius = 5.0
|
||||
|
|
@ -105,12 +106,17 @@ radius = 2.23607
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_7n10g"]
|
||||
radius = 17.2627
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_g3wua"]
|
||||
radius = 9.0
|
||||
|
||||
[node name="FSMPlayer" type="CharacterBody2D"]
|
||||
process_mode = 1
|
||||
collision_layer = 2
|
||||
collision_mask = 97
|
||||
platform_wall_layers = 97
|
||||
script = ExtResource("1_mpmil")
|
||||
InitialState = 1
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Init" type="Node2D" parent="."]
|
||||
script = ExtResource("2_i6wc8")
|
||||
|
|
@ -245,6 +251,15 @@ shape = SubResource("CircleShape2D_7n10g")
|
|||
[node name="Error" type="AudioStreamPlayer2D" parent="InteractionProvider"]
|
||||
stream = ExtResource("24_5tmtw")
|
||||
|
||||
[node name="InteractionController" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
script = ExtResource("27_vwjki")
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="InteractionController"]
|
||||
shape = SubResource("CircleShape2D_g3wua")
|
||||
|
||||
[connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"]
|
||||
[connection signal="area_entered" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_entered"]
|
||||
[connection signal="area_exited" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_exited"]
|
||||
|
|
|
|||
|
|
@ -10,18 +10,24 @@ public partial class Interactable : Area2D
|
|||
{
|
||||
[Export] public Array<LootItem> Requirements = [];
|
||||
|
||||
protected InventoryManager _inventoryManager;
|
||||
//protected InventoryManager _inventoryManager;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_inventoryManager = this.GetInventoryManager();
|
||||
//_inventoryManager = this.GetInventoryManager();
|
||||
//CallDeferred(MethodName.DeferredInitReferences);
|
||||
}
|
||||
|
||||
// private void DeferredInitReferences()
|
||||
// {
|
||||
// _inventoryManager = InventoryManager.Instance;
|
||||
// }
|
||||
|
||||
protected bool MeetsRequirements()
|
||||
{
|
||||
if (Requirements.Any())
|
||||
{
|
||||
if (_inventoryManager.HasItems(Requirements.Select(x => x.ItemKey).ToList()))
|
||||
if (InventoryManager.Instance.HasItems(Requirements.Select(x => x.ItemKey).ToList()))
|
||||
{
|
||||
GD.Print($"Requirements for activation of {this.Name} successfully met: {string.Join(",", Requirements.Select(x => x.Item))} ");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -533,6 +533,9 @@ position = Vector2(-912, -348)
|
|||
[node name="RedKeyCard2" parent="Factory Tilemaps/Debug Room" instance=ExtResource("19_8fb73")]
|
||||
position = Vector2(-904, -348)
|
||||
|
||||
[node name="RedKeyCard3" parent="Factory Tilemaps/Debug Room" instance=ExtResource("19_8fb73")]
|
||||
position = Vector2(-700, -452)
|
||||
|
||||
[node name="IcicleGun" parent="Factory Tilemaps/Debug Room" instance=ExtResource("10_iihys")]
|
||||
position = Vector2(-952, -381)
|
||||
|
||||
|
|
@ -557,14 +560,14 @@ position = Vector2(-615, -565)
|
|||
CameraOffset = Vector2(-50, 0)
|
||||
|
||||
[node name="ControlPad" parent="Factory Tilemaps/Debug Room" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-666, -491)
|
||||
position = Vector2(-615, -495)
|
||||
Target = NodePath("../Marisa")
|
||||
|
||||
[node name="Label2" type="Label" parent="Factory Tilemaps/Debug Room"]
|
||||
offset_left = -687.0
|
||||
offset_top = -485.0
|
||||
offset_right = -635.0
|
||||
offset_bottom = -462.0
|
||||
offset_left = -637.0
|
||||
offset_top = -486.0
|
||||
offset_right = -585.0
|
||||
offset_bottom = -463.0
|
||||
text = "Start Marisa"
|
||||
label_settings = ExtResource("14_c4c20")
|
||||
|
||||
|
|
@ -631,6 +634,10 @@ StartingAiState = 1
|
|||
[node name="HeartPickup" parent="Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||
position = Vector2(-767, -395)
|
||||
|
||||
[node name="RedKeycard_Switch_3" parent="Factory Tilemaps/Debug Room" node_paths=PackedStringArray("Targets") instance=ExtResource("17_e3v0b")]
|
||||
position = Vector2(-701, -486)
|
||||
Targets = [NodePath("../HorizontalForceField")]
|
||||
|
||||
[node name="Part2" type="Node2D" parent="Factory Tilemaps"]
|
||||
|
||||
[node name="Mainframe" parent="Factory Tilemaps/Part2" instance=ExtResource("13_acrmt")]
|
||||
|
|
@ -902,7 +909,8 @@ position = Vector2(-1506, -188)
|
|||
Events = Array[Object]([SubResource("Resource_hppa0")])
|
||||
|
||||
[node name="LevelStartTrigger" parent="Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")]
|
||||
position = Vector2(-779, -159)
|
||||
position = Vector2(-776, -160)
|
||||
scale = Vector2(1.455, 1.455)
|
||||
Events = Array[Object]([SubResource("Resource_5er5x"), SubResource("Resource_b25hy")])
|
||||
|
||||
[node name="AreaTrigger2" parent="Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("28_6au4t")]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public partial class Chest : Interactable
|
|||
if (!MeetsRequirements()) return false;
|
||||
foreach (var item in LootTable)
|
||||
{
|
||||
_inventoryManager.AddItem(item);
|
||||
InventoryManager.Instance.AddItem(item);
|
||||
}
|
||||
|
||||
_sprite.Play("Opening");
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public partial class AreaTrigger : Area2D
|
|||
[Signal]
|
||||
public delegate void ActivatedEventHandler();
|
||||
|
||||
public bool Activate(InteractionController player)
|
||||
private bool Activate()
|
||||
{
|
||||
if (_activations == 0 && DoNotActivateOnFirst)
|
||||
{
|
||||
|
|
@ -47,6 +47,6 @@ public partial class AreaTrigger : Area2D
|
|||
private void _on_area_entered(Area2D area)
|
||||
{
|
||||
if (area is not InteractionController player) return;
|
||||
Activate(player);
|
||||
Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ public partial class ItemPickup : Interactable
|
|||
if (!MeetsRequirements()) return false;
|
||||
foreach (var item in LootTable)
|
||||
{
|
||||
_inventoryManager.AddItem(item);
|
||||
InventoryManager.Instance.AddItem(item);
|
||||
}
|
||||
|
||||
// Delet This
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Cirno.Scripts.Resources;
|
|||
|
||||
public partial class InventoryManager : Node2D
|
||||
{
|
||||
public static InventoryManager Instance { get; private set; }
|
||||
public bool RedKeycard { get; set; }
|
||||
|
||||
private Dictionary<string, ItemContainer> _itemsDict = new Dictionary<string, ItemContainer>();
|
||||
|
|
@ -24,10 +25,10 @@ public partial class InventoryManager : Node2D
|
|||
|
||||
[Signal]
|
||||
public delegate void ItemUsedEventHandler(LootItem itemKey, int totalCount);
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue