From 5ae8b6f08ca9fa0205efad480242155693b34439 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 30 Oct 2025 00:57:28 +0100 Subject: [PATCH] Add door interaction system with requirements and HUD integration --- Code/Factories/ComponentFactory.cs | 27 +++++- .../InteractionRequirementFactory.cs | 19 +++++ .../InteractionRequirementFactory.cs.uid | 1 + Code/Presenters/DoorPresenter.cs | 54 ++++++++++++ Code/Presenters/DoorPresenter.cs.uid | 1 + Code/Presenters/GamePresenter.cs | 9 +- Code/Presenters/HudPresenterComponent.cs | 35 ++++++++ Code/Resources/DoorComponentResource.cs | 15 ++++ Code/Resources/DoorComponentResource.cs.uid | 1 + .../InteractionRequirementResource.cs | 9 ++ .../InteractionRequirementResource.cs.uid | 1 + .../RequiresAttributeRequirementResource.cs | 13 +++ ...equiresAttributeRequirementResource.cs.uid | 1 + .../RequiresItemRequirementResource.cs | 11 +++ .../RequiresItemRequirementResource.cs.uid | 1 + Code/Services/GodotInputService.cs | 2 +- Objects/UI/player_hud.tscn | 9 +- Objects/green_card_pickup.tscn | 35 ++++++++ Objects/green_door.tscn | 84 +++++++++++++++++++ Resources/Weapons/basic_pistol.tres | 14 ++-- Scenes/game_world.tscn | 9 +- 21 files changed, 337 insertions(+), 14 deletions(-) create mode 100644 Code/Factories/InteractionRequirementFactory.cs create mode 100644 Code/Factories/InteractionRequirementFactory.cs.uid create mode 100644 Code/Presenters/DoorPresenter.cs create mode 100644 Code/Presenters/DoorPresenter.cs.uid create mode 100644 Code/Resources/DoorComponentResource.cs create mode 100644 Code/Resources/DoorComponentResource.cs.uid create mode 100644 Code/Resources/InteractionRequirementResource.cs create mode 100644 Code/Resources/InteractionRequirementResource.cs.uid create mode 100644 Code/Resources/RequiresAttributeRequirementResource.cs create mode 100644 Code/Resources/RequiresAttributeRequirementResource.cs.uid create mode 100644 Code/Resources/RequiresItemRequirementResource.cs create mode 100644 Code/Resources/RequiresItemRequirementResource.cs.uid create mode 100644 Objects/green_card_pickup.tscn create mode 100644 Objects/green_door.tscn diff --git a/Code/Factories/ComponentFactory.cs b/Code/Factories/ComponentFactory.cs index 09e0f5b..0a109ba 100644 --- a/Code/Factories/ComponentFactory.cs +++ b/Code/Factories/ComponentFactory.cs @@ -7,6 +7,7 @@ using GameCore.Combat; using GameCore.Combat.Interfaces; using GameCore.ECS.Interfaces; using GameCore.Input; +using GameCore.Interaction; using GameCore.Inventory; using GameCore.Movement; using GameCore.Physics; @@ -19,10 +20,12 @@ public class ComponentFactory { private readonly Dictionary> _factories = new(); private readonly EffectFactory _effectFactory; + private readonly InteractionRequirementFactory _requirementFactory; - public ComponentFactory(EffectFactory effectFactory) + public ComponentFactory(EffectFactory effectFactory, InteractionRequirementFactory requirementFactory) { _effectFactory = effectFactory; + _requirementFactory = requirementFactory; Register(CreateAttributeComponent); Register(CreateWeaponComponent); @@ -36,6 +39,7 @@ public class ComponentFactory Register(_ => new InventoryComponent()); Register(CreatePickupComponent); Register(_ => new EquipmentComponent()); + Register(CreateDoorComponent); } public IComponent Create(Resource resource) @@ -104,4 +108,25 @@ public class ComponentFactory OnAcquireEffects = onAcquireEffects, }; } + + private DoorComponent CreateDoorComponent(DoorComponentResource resource) + { + var component = new DoorComponent + { + CurrentState = resource.InitialState, + IsOneTimeUnlock = resource.IsOneTimeUnlock, + OpenSpeed = resource.OpenSpeed, + }; + + foreach (var reqResource in resource.Requirements) + { + var requirement = _requirementFactory.Create(reqResource); + if (requirement != null) + { + component.Requirements.Add(requirement); + } + } + + return component; + } } \ No newline at end of file diff --git a/Code/Factories/InteractionRequirementFactory.cs b/Code/Factories/InteractionRequirementFactory.cs new file mode 100644 index 0000000..6ed5ea5 --- /dev/null +++ b/Code/Factories/InteractionRequirementFactory.cs @@ -0,0 +1,19 @@ +using System; +using CryptonymThunder.Code.Resources; +using GameCore.Interaction; +using GameCore.Interaction.Interfaces; + +namespace CryptonymThunder.Code.Factories; + +public class InteractionRequirementFactory +{ + public IInteractionRequirement Create(InteractionRequirementResource resource) + { + return resource switch + { + RequiresItemRequirementResource itemReq => new RequiresItemRequirement(itemReq.ItemId, itemReq.Quantity, itemReq.ConsumeItem), + RequiresAttributeRequirementResource attrReq => new RequiresAttributeRequirement(attrReq.Attribute, attrReq.RequiredValue, attrReq.Comparison), + _ => throw new ArgumentOutOfRangeException(nameof(resource), $"Requirement type {resource.GetType().Name} not recognized") + }; + } +} \ No newline at end of file diff --git a/Code/Factories/InteractionRequirementFactory.cs.uid b/Code/Factories/InteractionRequirementFactory.cs.uid new file mode 100644 index 0000000..d4d0633 --- /dev/null +++ b/Code/Factories/InteractionRequirementFactory.cs.uid @@ -0,0 +1 @@ +uid://cdgsevqxru4oe diff --git a/Code/Presenters/DoorPresenter.cs b/Code/Presenters/DoorPresenter.cs new file mode 100644 index 0000000..1208463 --- /dev/null +++ b/Code/Presenters/DoorPresenter.cs @@ -0,0 +1,54 @@ +using GameCore.ECS; +using GameCore.ECS.Interfaces; +using GameCore.Interaction; +using Godot; + +namespace CryptonymThunder.Code.Presenters; + +[GlobalClass] +public partial class DoorPresenter : AnimatableBody3D, IEntityPresenter, IPresenterComponent +{ + [Export] private AnimationPlayer _animationPlayer; + [Export] private string _openAnimationName = "Open"; + + private DoorComponent _doorComponent; + private Animation _openAnimation; + + public Entity CoreEntity { get; set; } + + public void Initialize(Entity coreEntity, World world) + { + CoreEntity = coreEntity; + _doorComponent = world.GetComponent(CoreEntity); + + if (_animationPlayer == null) + { + world.Logger.Error($"DoorPresenter '{Name}' is missing an AnimationPlayer!"); + return; + } + + if (!_animationPlayer.HasAnimation(_openAnimationName)) + { + world.Logger.Error($"DoorPresenter '{Name}' AnimationPlayer is missing animation: '{_openAnimationName}'"); + return; + } + + _openAnimation = _animationPlayer.GetAnimation(_openAnimationName); + _animationPlayer.Play(_openAnimationName); + _animationPlayer.Pause(); + SyncToPresentation(0f); + } + + public void SyncToPresentation(float delta) + { + if (_doorComponent == null || _openAnimation == null) return; + + var targetTime = _doorComponent.OpenProgress * _openAnimation.Length; + + _animationPlayer.Seek(targetTime, true); + } + + public void SyncToCore(float delta) + { + } +} \ No newline at end of file diff --git a/Code/Presenters/DoorPresenter.cs.uid b/Code/Presenters/DoorPresenter.cs.uid new file mode 100644 index 0000000..a2ca112 --- /dev/null +++ b/Code/Presenters/DoorPresenter.cs.uid @@ -0,0 +1 @@ +uid://bxqite0b1di2b diff --git a/Code/Presenters/GamePresenter.cs b/Code/Presenters/GamePresenter.cs index 3e06c40..64b9619 100644 --- a/Code/Presenters/GamePresenter.cs +++ b/Code/Presenters/GamePresenter.cs @@ -11,6 +11,7 @@ using GameCore.ECS; using GameCore.ECS.Interfaces; using GameCore.Events; using GameCore.Input; +using GameCore.Interaction; using GameCore.Inventory; using GameCore.Logging; using GameCore.Logging.Interfaces; @@ -27,6 +28,7 @@ public partial class GamePresenter : Node [Export] private WeaponDatabase WeaponDatabase { get; set; } [Export] private EntityArchetype PlayerArchetype { get; set; } [Export] private SimulationConfigResource SimulationConfig { get; set; } + [Export(PropertyHint.Range, "1.0, 10.0, 0.1")] private float InteractionRange { get; set; } = 3.0f; private World _world; private PresenterRegistry _presenterRegistry; @@ -61,7 +63,8 @@ public partial class GamePresenter : Node _world = new World(_inputService, _worldQuery, simConfig, _logger); var effectFactory = new EffectFactory(); - var componentFactory = new ComponentFactory(effectFactory); + var requirementFactory = new InteractionRequirementFactory(); + var componentFactory = new ComponentFactory(effectFactory, requirementFactory); var weaponDataService = new GodotWeaponDataService(WeaponDatabase, effectFactory); _presenterFactory = new PresenterFactory(_world, componentFactory, _presenterRegistry, this); @@ -80,10 +83,14 @@ public partial class GamePresenter : Node _world.RegisterSystem(new WeaponSwapSystem()); _world.RegisterSystem(new EquipmentSystem(_world, weaponDataService)); + _world.RegisterSystem(new InteractionSystem(InteractionRange)); + _world.RegisterSystem(new DoorSystem()); + _world.RegisterSystem(new WeaponSystem()); _world.RegisterSystem(new ProjectileSystem()); _world.RegisterSystem(new ProjectileInitializationSystem(_world)); + _world.RegisterSystem(new HealingSystem(_world)); _world.RegisterSystem(new DamageSystem(_world)); _world.RegisterSystem(new ProjectileCleanupSystem()); diff --git a/Code/Presenters/HudPresenterComponent.cs b/Code/Presenters/HudPresenterComponent.cs index 98d44a6..c0aa35f 100644 --- a/Code/Presenters/HudPresenterComponent.cs +++ b/Code/Presenters/HudPresenterComponent.cs @@ -5,6 +5,7 @@ using GameCore.Combat.Effects; using GameCore.ECS; using GameCore.ECS.Interfaces; using GameCore.Events; +using GameCore.Interaction; using GameCore.Inventory; using GameCore.Player; using Godot; @@ -23,6 +24,7 @@ public partial class HudPresenterComponent : Control, IPresenterComponent [Export] private Label _healthLabel; [Export] private Label _ammoLabel; [Export] private Label _weaponLabel; + [Export] private Label _interactLabel; private string _currentAmmoId; @@ -45,6 +47,11 @@ public partial class HudPresenterComponent : Control, IPresenterComponent _world.Subscribe(OnEntityHealed); _world.Subscribe(OnInventoryChanged); _world.Subscribe(OnWeaponEquipped); + + if (_interactLabel != null) + { + _interactLabel.Visible = false; + } } private void OnWeaponEquipped(WeaponEquippedEvent e) @@ -113,6 +120,34 @@ public partial class HudPresenterComponent : Control, IPresenterComponent public void SyncToPresentation(float delta) { + if (_interactLabel != null) + { + var lookingAt = _world.GetComponent(_playerEntity); + if (lookingAt != null) + { + var door = _world.GetComponent(lookingAt.Target); + if (door != null) + { + var interactKey = "F"; + _interactLabel.Text = door.CurrentState switch + { + DoorComponent.DoorState.Locked => $"[{interactKey}] Interact (Locked)", + DoorComponent.DoorState.Closed => $"[{interactKey}] Open Door", + DoorComponent.DoorState.Open => $"[{interactKey}] Close Door", + _ => "" + }; + _interactLabel.Visible = !string.IsNullOrEmpty(_interactLabel.Text); + } + else + { + _interactLabel.Visible = false; + } + } + else + { + _interactLabel.Visible = false; + } + } } public void SyncToCore(float delta) diff --git a/Code/Resources/DoorComponentResource.cs b/Code/Resources/DoorComponentResource.cs new file mode 100644 index 0000000..183ba0f --- /dev/null +++ b/Code/Resources/DoorComponentResource.cs @@ -0,0 +1,15 @@ +using GameCore.Interaction; +using Godot; +using Godot.Collections; + +namespace CryptonymThunder.Code.Resources; + +[GlobalClass] +public partial class DoorComponentResource : Resource +{ + [Export] public DoorComponent.DoorState InitialState { get; set; } = DoorComponent.DoorState.Closed; + [Export] public bool IsOneTimeUnlock { get; set; } = false; + [Export(PropertyHint.Range, "0.1,10.0,0.1")] public float OpenSpeed { get; set; } = 1.0f; + + [ExportGroup("Requirements")] [Export] public Array Requirements { get; set; } = []; +} \ No newline at end of file diff --git a/Code/Resources/DoorComponentResource.cs.uid b/Code/Resources/DoorComponentResource.cs.uid new file mode 100644 index 0000000..3cfcba0 --- /dev/null +++ b/Code/Resources/DoorComponentResource.cs.uid @@ -0,0 +1 @@ +uid://ymtyxkea76mv diff --git a/Code/Resources/InteractionRequirementResource.cs b/Code/Resources/InteractionRequirementResource.cs new file mode 100644 index 0000000..28a7bd6 --- /dev/null +++ b/Code/Resources/InteractionRequirementResource.cs @@ -0,0 +1,9 @@ +using Godot; + +namespace CryptonymThunder.Code.Resources; + +[GlobalClass] +public partial class InteractionRequirementResource : Resource +{ + +} \ No newline at end of file diff --git a/Code/Resources/InteractionRequirementResource.cs.uid b/Code/Resources/InteractionRequirementResource.cs.uid new file mode 100644 index 0000000..ea883f1 --- /dev/null +++ b/Code/Resources/InteractionRequirementResource.cs.uid @@ -0,0 +1 @@ +uid://dtqh3dwx7xc5u diff --git a/Code/Resources/RequiresAttributeRequirementResource.cs b/Code/Resources/RequiresAttributeRequirementResource.cs new file mode 100644 index 0000000..fa340f4 --- /dev/null +++ b/Code/Resources/RequiresAttributeRequirementResource.cs @@ -0,0 +1,13 @@ +using GameCore.Attributes; +using GameCore.Interaction; +using Godot; + +namespace CryptonymThunder.Code.Resources; + +[GlobalClass] +public partial class RequiresAttributeRequirementResource : InteractionRequirementResource +{ + [Export] public Attribute Attribute { get; set; } = Attribute.Level; + [Export] public float RequiredValue { get; set; } = 1.0f; + [Export] public ComparisonType Comparison { get; set; } = ComparisonType.GreaterOrEqual; +} \ No newline at end of file diff --git a/Code/Resources/RequiresAttributeRequirementResource.cs.uid b/Code/Resources/RequiresAttributeRequirementResource.cs.uid new file mode 100644 index 0000000..a4b9484 --- /dev/null +++ b/Code/Resources/RequiresAttributeRequirementResource.cs.uid @@ -0,0 +1 @@ +uid://d07gx65gcsvb diff --git a/Code/Resources/RequiresItemRequirementResource.cs b/Code/Resources/RequiresItemRequirementResource.cs new file mode 100644 index 0000000..f78c5be --- /dev/null +++ b/Code/Resources/RequiresItemRequirementResource.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace CryptonymThunder.Code.Resources; + +[GlobalClass] +public partial class RequiresItemRequirementResource : InteractionRequirementResource +{ + [Export] public string ItemId { get; set; } = "item_key_green"; + [Export(PropertyHint.Range, "1,100,1")] public int Quantity { get; set; } = 1; + [Export] public bool ConsumeItem { get; set; } = true; +} \ No newline at end of file diff --git a/Code/Resources/RequiresItemRequirementResource.cs.uid b/Code/Resources/RequiresItemRequirementResource.cs.uid new file mode 100644 index 0000000..9553b12 --- /dev/null +++ b/Code/Resources/RequiresItemRequirementResource.cs.uid @@ -0,0 +1 @@ +uid://dnyfoaprv6bhw diff --git a/Code/Services/GodotInputService.cs b/Code/Services/GodotInputService.cs index fa8a6a3..0dfdf9d 100644 --- a/Code/Services/GodotInputService.cs +++ b/Code/Services/GodotInputService.cs @@ -39,7 +39,7 @@ public class GodotInputService : IInputService IsJumping = Input.IsActionJustPressed("jump"); IsFiring = Input.IsActionPressed("fire"); - IsInteracting = Input.IsActionPressed("interact"); + IsInteracting = Input.IsActionJustPressed("interact"); IsSwapWeaponNext = Input.IsActionJustPressed("swap_weapon_next"); IsSwapWeaponPrevious = Input.IsActionJustPressed("swap_weapon_previous"); } diff --git a/Objects/UI/player_hud.tscn b/Objects/UI/player_hud.tscn index 6faa2d5..19313df 100644 --- a/Objects/UI/player_hud.tscn +++ b/Objects/UI/player_hud.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://c6nouigv5wsu1" path="res://Code/Presenters/HudPresenterComponent.cs" id="1_yd76s"] -[node name="PlayerHUD" type="Control" node_paths=PackedStringArray("_healthLabel", "_ammoLabel", "_weaponLabel")] +[node name="PlayerHUD" type="Control" node_paths=PackedStringArray("_healthLabel", "_ammoLabel", "_weaponLabel", "_interactLabel")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -13,6 +13,7 @@ script = ExtResource("1_yd76s") _healthLabel = NodePath("MarginContainer/HBoxContainer/HealthLabel") _ammoLabel = NodePath("MarginContainer/HBoxContainer/AmmoLabel") _weaponLabel = NodePath("MarginContainer/HBoxContainer/WeaponLabel") +_interactLabel = NodePath("MarginContainer/Interact") metadata/_custom_type_script = "uid://c6nouigv5wsu1" [node name="MarginContainer" type="MarginContainer" parent="."] @@ -44,3 +45,9 @@ uppercase = true layout_mode = 2 text = "gun" uppercase = true + +[node name="Interact" type="Label" parent="MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "INTERACT" +uppercase = true diff --git a/Objects/green_card_pickup.tscn b/Objects/green_card_pickup.tscn new file mode 100644 index 0000000..65c9b75 --- /dev/null +++ b/Objects/green_card_pickup.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=8 format=3 uid="uid://cww3lcsxldnt3"] + +[ext_resource type="Script" uid="uid://ck82xby5qe680" path="res://Code/Presenters/PickupPresenter.cs" id="1_6m8gq"] +[ext_resource type="Script" uid="uid://b6x8llipvutqs" path="res://Code/Presenters/SceneEntity.cs" id="2_m5j0n"] +[ext_resource type="Script" uid="uid://cg8upylcrj8le" path="res://Code/Resources/PickupComponentResource.cs" id="3_1xw6x"] + +[sub_resource type="BoxMesh" id="BoxMesh_6m8gq"] +size = Vector3(0.4, 0.4, 0.3) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6m8gq"] +albedo_color = Color(0, 1, 0, 1) + +[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_m5j0n"] +points = PackedVector3Array(-0.19894178, -0.19894178, -0.14999999, 0.19999999, 0.19999999, 0.14920634, 0.19999999, -0.19999999, 0.14920634, -0.19999999, 0.19999999, 0.14920634, 0.19894178, 0.19894178, -0.14999999, -0.19999999, -0.19999999, 0.14920634, 0.19894178, -0.19894178, -0.14999999, -0.19894178, 0.19894178, -0.14999999) + +[sub_resource type="Resource" id="Resource_7g0sf"] +script = ExtResource("3_1xw6x") +ItemId = "item_key_green" +OnAcquireEffects = null +metadata/_custom_type_script = "uid://cg8upylcrj8le" + +[node name="Green Card Pickup" type="Area3D"] +script = ExtResource("1_6m8gq") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("BoxMesh_6m8gq") +surface_material_override/0 = SubResource("StandardMaterial3D_6m8gq") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("ConvexPolygonShape3D_m5j0n") + +[node name="SceneEntity" type="Node" parent="." groups=["SceneEntities"]] +script = ExtResource("2_m5j0n") +ComponentResources = Array[Resource]([SubResource("Resource_7g0sf")]) +metadata/_custom_type_script = "uid://b6x8llipvutqs" diff --git a/Objects/green_door.tscn b/Objects/green_door.tscn new file mode 100644 index 0000000..40d5c10 --- /dev/null +++ b/Objects/green_door.tscn @@ -0,0 +1,84 @@ +[gd_scene load_steps=13 format=3 uid="uid://b1d2gc8goj6gx"] + +[ext_resource type="Script" uid="uid://bxqite0b1di2b" path="res://Code/Presenters/DoorPresenter.cs" id="1_0k8gl"] +[ext_resource type="Script" uid="uid://b6x8llipvutqs" path="res://Code/Presenters/SceneEntity.cs" id="2_l5dry"] +[ext_resource type="Script" uid="uid://dnyfoaprv6bhw" path="res://Code/Resources/RequiresItemRequirementResource.cs" id="3_3dbp0"] +[ext_resource type="Script" uid="uid://ymtyxkea76mv" path="res://Code/Resources/DoorComponentResource.cs" id="4_g4ryb"] + +[sub_resource type="BoxMesh" id="BoxMesh_u2oqr"] +size = Vector3(1, 2, 0.3) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_l4yuh"] +albedo_color = Color(0.14891627, 0.744422, 0, 1) + +[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_l5dry"] +points = PackedVector3Array(-0.5, -1, -0.15, -0.5, -1, 0.15, -0.5, 1, -0.15, 0.5, -1, -0.15, 0.5, -1, 0.15, -0.5, 1, 0.15, 0.5, 1, -0.15, 0.5, 1, 0.15) + +[sub_resource type="Animation" id="Animation_rv1pd"] +resource_name = "open" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(0, 0, 0), Vector3(0, 3, 0)] +} + +[sub_resource type="Animation" id="Animation_me0pg"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(0, 0, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_dgrt5"] +_data = { +&"RESET": SubResource("Animation_me0pg"), +&"open": SubResource("Animation_rv1pd") +} + +[sub_resource type="Resource" id="Resource_g2hal"] +script = ExtResource("3_3dbp0") +metadata/_custom_type_script = "uid://dnyfoaprv6bhw" + +[sub_resource type="Resource" id="Resource_fyehb"] +script = ExtResource("4_g4ryb") +InitialState = 0 +Requirements = Array[Object]([SubResource("Resource_g2hal")]) +metadata/_custom_type_script = "uid://ymtyxkea76mv" + +[node name="GreenDoor" type="AnimatableBody3D" node_paths=PackedStringArray("_animationPlayer")] +script = ExtResource("1_0k8gl") +_animationPlayer = NodePath("AnimationPlayer") +_openAnimationName = "open" +metadata/_custom_type_script = "uid://bxqite0b1di2b" + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("BoxMesh_u2oqr") +surface_material_override/0 = SubResource("StandardMaterial3D_l4yuh") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("ConvexPolygonShape3D_l5dry") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_dgrt5") +} + +[node name="SceneEntity" type="Node" parent="." groups=["SceneEntities"]] +script = ExtResource("2_l5dry") +ComponentResources = Array[Resource]([SubResource("Resource_fyehb")]) +metadata/_custom_type_script = "uid://b6x8llipvutqs" diff --git a/Resources/Weapons/basic_pistol.tres b/Resources/Weapons/basic_pistol.tres index 54d4da5..6fd04e0 100644 --- a/Resources/Weapons/basic_pistol.tres +++ b/Resources/Weapons/basic_pistol.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="WeaponResource" load_steps=8 format=3 uid="uid://tj3ojc3bl7d8"] -[ext_resource type="Script" uid="uid://cht6trljihvle" path="res://Code/Resources/Effects/FireProjectileEffectResource.cs" id="1_p2b4p"] [ext_resource type="Script" uid="uid://hf0iut8o8do3" path="res://Code/Resources/WeaponResource.cs" id="1_qn35l"] [ext_resource type="Script" uid="uid://b6argm77cho2t" path="res://Code/Resources/Effects/ConsumeAmmoCostResource.cs" id="1_yt3rn"] +[ext_resource type="Script" uid="uid://chc0d0rjcbl65" path="res://Code/Resources/Effects/HitscanEffectResource.cs" id="2_1h0aq"] [ext_resource type="Script" uid="uid://btv24gsw1p850" path="res://Code/Resources/Effects/DamageEffectResource.cs" id="2_yt3rn"] [sub_resource type="Resource" id="Resource_1h0aq"] @@ -10,13 +10,9 @@ script = ExtResource("1_yt3rn") AmmoId = "basic_bullet" metadata/_custom_type_script = "uid://b6argm77cho2t" -[sub_resource type="Resource" id="Resource_yt3rn"] -script = ExtResource("1_p2b4p") -ProjectileArchetypeId = "basic_bullet" -Count = 3 -SpreadAngle = 5.7 -ProjectileSpeed = 10.0 -metadata/_custom_type_script = "uid://cht6trljihvle" +[sub_resource type="Resource" id="Resource_i15wf"] +script = ExtResource("2_1h0aq") +metadata/_custom_type_script = "uid://chc0d0rjcbl65" [sub_resource type="Resource" id="Resource_wqp4f"] script = ExtResource("2_yt3rn") @@ -26,6 +22,6 @@ metadata/_custom_type_script = "uid://btv24gsw1p850" script = ExtResource("1_qn35l") FireRate = 10.0 FireCosts = Array[Object]([SubResource("Resource_1h0aq")]) -OnFireEffects = Array[Object]([SubResource("Resource_yt3rn")]) +OnFireEffects = Array[Object]([SubResource("Resource_i15wf")]) OnHitEffects = Array[Object]([SubResource("Resource_wqp4f")]) metadata/_custom_type_script = "uid://hf0iut8o8do3" diff --git a/Scenes/game_world.tscn b/Scenes/game_world.tscn index 2cf273d..2d6b794 100644 --- a/Scenes/game_world.tscn +++ b/Scenes/game_world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=4 uid="uid://bkvgcsb8d3v7p"] +[gd_scene load_steps=27 format=4 uid="uid://bkvgcsb8d3v7p"] [ext_resource type="Script" uid="uid://cfpm5p102f65x" path="res://Code/Presenters/GamePresenter.cs" id="1_qvgq0"] [ext_resource type="Resource" uid="uid://biev6ri5s8kyf" path="res://Resources/Entities/player.tres" id="2_alii3"] @@ -12,6 +12,8 @@ [ext_resource type="PackedScene" uid="uid://bqdgw5gimh5ug" path="res://Objects/knife_pickup.tscn" id="11_l855d"] [ext_resource type="Script" uid="uid://uearpvfk21ym" path="res://Code/Resources/SimulationConfigResource.cs" id="11_xnm3i"] [ext_resource type="PackedScene" uid="uid://bfnu4py7n2sv5" path="res://Objects/pistol_pickup.tscn" id="12_00aki"] +[ext_resource type="PackedScene" uid="uid://b1d2gc8goj6gx" path="res://Objects/green_door.tscn" id="13_00aki"] +[ext_resource type="PackedScene" uid="uid://cww3lcsxldnt3" path="res://Objects/green_card_pickup.tscn" id="14_5qvjo"] [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_ucfah"] data = PackedVector3Array(-4.282257, -0.5, 4.977783, -4.282257, -0.5, -4.977783, -4.282257, 0.5, -4.977783, 4.282257, -0.5, -4.977783, -4.282257, -0.5, -4.977783, -4.282257, -0.5, 4.977783, -4.282257, 0.5, -4.977783, -4.282257, -0.5, -4.977783, 4.282257, -0.5, -4.977783, -4.282257, 0.5, -4.977783, -4.282257, 0.5, 4.977783, -4.282257, -0.5, 4.977783, -4.282257, -0.5, 4.977783, -4.282257, 0.5, 4.977783, 4.282257, 0.5, 4.977783, 4.282257, 0.5, 4.977783, -4.282257, 0.5, 4.977783, -4.282257, 0.5, -4.977783, -4.282257, -0.5, 4.977783, 4.282257, -0.5, 4.977783, 4.282257, -0.5, -4.977783, 4.282257, 0.5, 4.977783, 4.282257, -0.5, 4.977783, -4.282257, -0.5, 4.977783, 4.282257, -0.5, -4.977783, 4.282257, -0.5, 4.977783, 4.282257, 0.5, 4.977783, 4.282257, -0.5, -4.977783, 4.282257, 0.5, -4.977783, -4.282257, 0.5, -4.977783, -4.282257, 0.5, -4.977783, 4.282257, 0.5, -4.977783, 4.282257, 0.5, 4.977783, 4.282257, 0.5, 4.977783, 4.282257, 0.5, -4.977783, 4.282257, -0.5, -4.977783) @@ -247,3 +249,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.7087288, -0.8145535, 4.614 [node name="Pistol" parent="." instance=ExtResource("12_00aki")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.122588, -0.81455374, 1.582226) + +[node name="GreenDoor" parent="." instance=ExtResource("13_00aki")] + +[node name="Green Card Pickup" parent="." instance=ExtResource("14_5qvjo")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.2713692, -0.86455375, 3.3032908)