did a shitton of refactoring.
still has bugs, but almost works like the original, but has much better structure. still might have to change around a bit, but closing in to the final form.
This commit is contained in:
parent
6b1aef8846
commit
0a764354ba
44 changed files with 1916 additions and 424 deletions
9
classes/equippable_item.gd
Normal file
9
classes/equippable_item.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class_name EquippableItem extends RigidBody3D
|
||||
|
||||
var weight: float = 10.0
|
||||
|
||||
func _ready() -> void:
|
||||
self.add_to_group("equippable")
|
||||
for x in get_children():
|
||||
x.add_to_group("equippable")
|
||||
collision_layer = 17
|
||||
1
classes/equippable_item.gd.uid
Normal file
1
classes/equippable_item.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://yggv7ie8yere
|
||||
5
classes/player_properties.gd
Normal file
5
classes/player_properties.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class_name PlayerProperties
|
||||
|
||||
var stamina_component: StaminaComponent = StaminaComponent.new()
|
||||
var flashlight_component: FlashlightComponent = FlashlightComponent.new()
|
||||
var inventory_component: InventoryComponent = InventoryComponent.new()
|
||||
1
classes/player_properties.gd.uid
Normal file
1
classes/player_properties.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ww58fe1kftaw
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
|
||||
excalidraw-plugin: parsed
|
||||
tags: [excalidraw]
|
||||
|
||||
---
|
||||
==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠== You can decompress Drawing data with the command palette: 'Decompress current Excalidraw file'. For more info check in plugin settings under 'Saving'
|
||||
|
||||
|
||||
# Excalidraw Data
|
||||
|
||||
## Text Elements
|
||||
player ^Yrru4SGK
|
||||
|
||||
root ^RE7VsbZ9
|
||||
|
||||
Components
|
||||
(do not interact with eachother) ^RUmP3xAM
|
||||
|
||||
Movement
|
||||
CameraMovement
|
||||
ProceduralAnimation
|
||||
Prompt
|
||||
InputManager
|
||||
Inventory
|
||||
Sound
|
||||
Flashlight
|
||||
Stamina
|
||||
^JbW24bmk
|
||||
|
||||
PlayerProperties ^39mb6ETP
|
||||
|
||||
GlobalSignals ^Sp3vmF7T
|
||||
|
||||
%%
|
||||
## Drawing
|
||||
```compressed-json
|
||||
N4KAkARALgngDgUwgLgAQQQDwMYEMA2AlgCYBOuA7hADTgQBuCpAzoQPYB2KqATLZMzYBXUtiRoIACyhQ4zZAHoFAc0JRJQgEYA6bGwC2CgF7N6hbEcK4OCtptbErHALRY8RMpWdx8Q1TdIEfARcZgRmBShcZQUebR4ANm0AFho6IIR9BA4oZm4AbXAwUDBSiBJuCABBACEADnoATQApQno00shYRErA7CiOZWCOssxuZwBmAEY67QSpiYBOCeSe
|
||||
|
||||
ReT1pf4ymG4pmYAGbX2DgHYEngmJurrTusXtyAoSdW5E06O1uqupnluJ84JR5SBCEZTSN5XRZzHiJZKrVYHGbJYHWIbiVAHYHMKCkNgAawQAGE2Pg2KRKgBiKYIGk0kaQTS4bD45R4oQcYgkskUiS46zMOC4QI5BkQABmhHw+AAyrBhhJBB4xTi8YSAOovSRvbG4gkIOUwBXoJUVYHs8EccJ5NBTYFsIXYNS7W0HLFFSBs4RwACSxBtqHyAF1geL
|
||||
|
||||
yFk/dwOEJpcDCJysJVcAcxezOVbmAGSp1oPAMRMPQBfbEIBDEPbXA48ZIJBLJOrAxgsdhcNCJB4ehhMVicABynDEez+p0WBwArItfnHmAARDJQMvccUEMLAzTCTkAUWCWRyAeDwKEcGIuAX5dtdwulx4UwRds7RA4+KjMfwwLJLMXaGX+FXnckoQACpYFAAAy8bPt+K4IEUxZFNmkAVBIRJGFUABKyT4pIpxit0GIQH0AzomKYxoM4PCnGO2gTPM
|
||||
|
||||
VYHHUt4JP8wIuqgvwrNoY4HBMY6JDxywJGOwLPMQrxoHcEzHPCY6nLCdbLNxwKSKC4JQNwCSUdo44HDWdQUR8BxMaigzGu6Oaqvq3LklSdK0kga7MqyaZcqS1l8uQHCCsK2RqaGUqyvK+GmuWupqggmqidqbahfq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wCNA5mRpCLEsGLhrAtUJ+CAEYAeQDCEODAA
|
||||
|
||||
gPgkFxzAdsWieTkv2BH3CdhTUfXP+yajJC2QJAayqXzCHSjiAcoBAJYRuHfCFRN+GqKCNwDmZQ+T3EgCLjBg1BSQEMUgMoCZAnobwjxXgDdGoDWirRZtCTDmCwTKAYwwoXoGaNwAWitEtoy4FiF4DejMQnEb9FDmFEbxfExwjgp5BxqQcsgWCBMHAgSZgxsg2o4IGVEUw0YiAKosfslU7BEpghNKcfm7AwQ38CxOY+tsKEJCkBewpabgOmPLGkBK
|
||||
|
||||
xWonUWmOKIhi7AAxWrswBlBEo4AGohAE2NTGCDWk/QNoAgEAgPJ8AAQjfIqAyAjjs4mKIQDiAMAIjlszHWQYw2RYGAZQs4yMYIMByhBH4I4xgOONJChwQxjgZgCmL8Q5AQIMqbIEICHGx0LBH+NykwGyAzJYmV4xoeUGYB6sBxu0OsYhHTwkABWG8HsXAHdL/iWxZYqPJgG3HBA5xHAPsZUH8pcBwAPUAEsECzAeDCwQAA==
|
||||
```
|
||||
%%
|
||||
0
concept/breadwinner/!documentation/ran game structure.md
Normal file
0
concept/breadwinner/!documentation/ran game structure.md
Normal file
3
concept/breadwinner/.obsidian/community-plugins.json
vendored
Normal file
3
concept/breadwinner/.obsidian/community-plugins.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
"obsidian-excalidraw-plugin"
|
||||
]
|
||||
1113
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/data.json
vendored
Normal file
1113
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/data.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
32
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/main.js
vendored
Normal file
32
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/main.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/manifest.json
vendored
Normal file
12
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/manifest.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.26.4",
|
||||
"minAppVersion": "1.8.7",
|
||||
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://excalidraw-obsidian.online",
|
||||
"fundingUrl": "https://ko-fi.com/zsolt",
|
||||
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
1
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/styles.css
vendored
Normal file
1
concept/breadwinner/.obsidian/plugins/obsidian-excalidraw-plugin/styles.css
vendored
Normal file
File diff suppressed because one or more lines are too long
45
concept/breadwinner/.obsidian/workspace.json
vendored
45
concept/breadwinner/.obsidian/workspace.json
vendored
|
|
@ -34,9 +34,35 @@
|
|||
"icon": "lucide-file",
|
||||
"title": "MVP Functionality"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "f8879d0b366e958d",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "!documentation/ran game structure.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "ran game structure"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "d92f27294db0bd17",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "excalidraw",
|
||||
"state": {
|
||||
"file": "!documentation/Drawing 2026-08-08 23.06.03.excalidraw.md"
|
||||
},
|
||||
"icon": "excalidraw-icon",
|
||||
"title": "Drawing 2026-08-08 23.06.03.excalidraw"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 1
|
||||
"currentTab": 3
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
|
|
@ -56,7 +82,9 @@
|
|||
"type": "file-explorer",
|
||||
"state": {
|
||||
"sortOrder": "alphabetical",
|
||||
"autoReveal": false
|
||||
"autoReveal": false,
|
||||
"showSearch": false,
|
||||
"searchQuery": ""
|
||||
},
|
||||
"icon": "lucide-folder-closed",
|
||||
"title": "Fájlkezelő"
|
||||
|
|
@ -206,11 +234,17 @@
|
|||
"daily-notes:Mai jegyzet megnyitása": false,
|
||||
"templates:Sablon beszúrása": false,
|
||||
"command-palette:Parancspaletta megnyitása": false,
|
||||
"bases:Új bázis létrehozása": false
|
||||
"bases:Új bázis létrehozása": false,
|
||||
"obsidian-excalidraw-plugin:New drawing": false
|
||||
}
|
||||
},
|
||||
"active": "cc30646b046d3148",
|
||||
"active": "787ccec16a03f34e",
|
||||
"lastOpenFiles": [
|
||||
"!documentation/ran game structure.md",
|
||||
"!documentation/Drawing 2026-08-08 23.06.03.excalidraw.md",
|
||||
"Excalidraw",
|
||||
"TLDR/MVP Functionality.md",
|
||||
"!documentation",
|
||||
"TLDR/MVP Assets.md",
|
||||
"TLDR/MVP.md",
|
||||
"game mechanics/The upgrain shop.md",
|
||||
|
|
@ -229,15 +263,12 @@
|
|||
"entities/Serbreads.md",
|
||||
"entities/IT.md",
|
||||
"entities/PlayerEntity.md",
|
||||
"TLDR/MVP Functionality.md",
|
||||
"TLDR",
|
||||
"concepts and lore/Lore.md",
|
||||
"game mechanics/The pawn shop.md",
|
||||
"game mechanics/The safe zone.md",
|
||||
"game mechanics/The PSA system.md",
|
||||
"thing groups/Grabbable.md",
|
||||
"thing groups/!Group rules.md",
|
||||
"thing groups/Entity.md",
|
||||
"Pasted image 20260728145533.png",
|
||||
"game mechanics",
|
||||
"thing groups",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://chykk2a3opu0d"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yggv7ie8yere" path="res://classes/equippable_item.gd" id="1_mtlx8"]
|
||||
[ext_resource type="PackedScene" uid="uid://kqq30y24c6kd" path="res://scenes/player/player.tscn" id="1_s8b7j"]
|
||||
[ext_resource type="AudioStream" uid="uid://b6wlbiittcu48" path="res://assets/sounds/ambiance/harmonika-paulstretched.mp3" id="2_afrty"]
|
||||
[ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="4_yb1w3"]
|
||||
|
|
@ -67,10 +68,11 @@ shape = SubResource("BoxShape3D_yf5fn")
|
|||
[node name="MeshInstance3D" type="MeshInstance3D" parent="TestObjectGrabbable" unique_id=1899834557]
|
||||
mesh = SubResource("BoxMesh_yf5fn")
|
||||
|
||||
[node name="TestObjectEquippable" type="RigidBody3D" parent="." unique_id=1086000939 groups=["equippable"]]
|
||||
[node name="TestObjectEquippable" type="RigidBody3D" parent="." unique_id=661564513 groups=["equippable"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.874709, 1.0290127, -3.1515453)
|
||||
collision_layer = 17
|
||||
collision_mask = 17
|
||||
script = ExtResource("1_mtlx8")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TestObjectEquippable" unique_id=740741417]
|
||||
shape = SubResource("BoxShape3D_yf5fn")
|
||||
|
|
@ -78,10 +80,11 @@ shape = SubResource("BoxShape3D_yf5fn")
|
|||
[node name="MeshInstance3D" type="MeshInstance3D" parent="TestObjectEquippable" unique_id=1967579265]
|
||||
mesh = SubResource("BoxMesh_yf5fn")
|
||||
|
||||
[node name="TestObjectEquippable2" type="RigidBody3D" parent="." unique_id=1583455063 groups=["equippable"]]
|
||||
[node name="TestObjectEquippable2" type="RigidBody3D" parent="." unique_id=565168632 groups=["equippable"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.874709, 1.0290127, -0.18258262)
|
||||
collision_layer = 17
|
||||
collision_mask = 17
|
||||
script = ExtResource("1_mtlx8")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TestObjectEquippable2" unique_id=1155644968]
|
||||
shape = SubResource("BoxShape3D_yf5fn")
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ Sounds="*uid://c4vhdhbi2yu8i"
|
|||
LoadingScreen="*uid://br8pa51piwxuy"
|
||||
GrabbableBase="*uid://csj6ipagcwmeu"
|
||||
Report="*uid://c76y0hv0jqdr3"
|
||||
UiManager="*uid://dtrfb3xosj32r"
|
||||
GameState="*uid://drxx0ny7uim8k"
|
||||
GlobalSignals="*uid://cky5rk5obojex"
|
||||
|
||||
[display]
|
||||
|
||||
|
|
@ -51,6 +54,7 @@ version_control/autoload_on_startup=true
|
|||
folder_colors={
|
||||
"res://addons/": "yellow",
|
||||
"res://assets/": "red",
|
||||
"res://classes/": "pink",
|
||||
"res://concept/": "purple",
|
||||
"res://maps/": "orange",
|
||||
"res://scenes/": "blue",
|
||||
|
|
@ -62,6 +66,7 @@ folder_colors={
|
|||
|
||||
grabbable="this object can be grabbed"
|
||||
equippable="the item is equippable"
|
||||
player="players"
|
||||
|
||||
[input]
|
||||
|
||||
|
|
|
|||
17
scenes/player/flashlight_component.gd
Normal file
17
scenes/player/flashlight_component.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class_name FlashlightComponent extends Node
|
||||
|
||||
@export var flashlight: SpotLight3D
|
||||
|
||||
var flashlight_on: bool = true
|
||||
var flashlight_charge: float = 100.0
|
||||
|
||||
func toggle_flashlight():
|
||||
flashlight_on = !flashlight_on
|
||||
flashlight.visible = flashlight_on
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if flashlight_on and flashlight_charge > 0:
|
||||
flashlight_charge = move_toward(flashlight_charge, 0, .2 * delta)
|
||||
|
||||
func _ready() -> void:
|
||||
GlobalSignals.toggle_flashlight.connect(toggle_flashlight)
|
||||
1
scenes/player/flashlight_component.gd.uid
Normal file
1
scenes/player/flashlight_component.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dntoi54g4hqce
|
||||
39
scenes/player/head_movement.gd
Normal file
39
scenes/player/head_movement.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
extends Node
|
||||
|
||||
@onready var procedural_camera_mover: Node = %ProceduralCameraMover
|
||||
@onready var camera: Camera3D = %PlayerCamera
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var player_state: Node = %PlayerState
|
||||
|
||||
|
||||
var mouse_motion: Vector2 = Vector2.ZERO
|
||||
var mouse_motion_delta: Vector2 = Vector2.ZERO
|
||||
|
||||
func handle_joypad_movement(delta: float):
|
||||
var controller_look_vector = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50
|
||||
|
||||
if controller_look_vector.length() > 0:
|
||||
mouse_motion += controller_look_vector
|
||||
mouse_motion_delta = controller_look_vector
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not player_state.in_menu:
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
#so it doesnt yank
|
||||
if event.relative.length() > 400:
|
||||
return
|
||||
|
||||
mouse_motion += event.relative
|
||||
mouse_motion_delta = event.relative
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not Console.toggled or not player_state.in_menu:
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
player.transform.basis = lerp(player.transform.basis, Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0)), delta * 30)
|
||||
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 30)
|
||||
camera.rotation += procedural_camera_mover.target_rotation
|
||||
handle_joypad_movement(delta)
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
1
scenes/player/head_movement.gd.uid
Normal file
1
scenes/player/head_movement.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b28vkjlgyrfa4
|
||||
|
|
@ -1,38 +1,17 @@
|
|||
extends Node
|
||||
class_name InputController extends Node
|
||||
|
||||
@onready var ui_handler: Node = %UiHandler
|
||||
@onready var player_state: Node = %PlayerState
|
||||
@onready var flashlight: SpotLight3D = %Flashlight
|
||||
@onready var sound_controller: Node = %SoundController
|
||||
@onready var cursor_raycast: RayCast3D = %CursorRaycast
|
||||
@onready var prompt: Control = %Prompt
|
||||
@onready var stamina_reset: Timer = %StaminaReset
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var procedural_camera_mover: Node = %ProceduralCameraMover
|
||||
@onready var camera: Camera3D = %PlayerCamera
|
||||
@onready var hold_position: Marker3D = %HoldPosition
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
@onready var ui: Control = %PlayerUi
|
||||
@onready var debug_menu: Control = %DebugMenu
|
||||
|
||||
var sensitivity: float = 0.002
|
||||
|
||||
var mouse_motion: Vector2 = Vector2.ZERO
|
||||
var mouse_motion_delta: Vector2 = Vector2.ZERO
|
||||
@export var cursor_raycast: RayCast3D
|
||||
@export var prompt: Control
|
||||
@export var player: Player
|
||||
@export var hold_position: Marker3D
|
||||
|
||||
var held_object: RigidBody3D = null
|
||||
|
||||
func toggle_flashlight():
|
||||
flashlight.visible = !flashlight.visible
|
||||
sound_controller.play_flashlight_sound()
|
||||
signal toggle_flashlight
|
||||
signal stamina_reset
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not Console.toggled or not player_state.in_menu:
|
||||
procedural_camera_mover.do(delta)
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
player.transform.basis = lerp(player.transform.basis, Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0)), delta * 30)
|
||||
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 30)
|
||||
camera.rotation += procedural_camera_mover.target_rotation
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if not Console.toggled or not UiManager.in_game_menu.visible:
|
||||
#handle grabbed object
|
||||
if held_object != null:
|
||||
var target_pos = hold_position.global_position
|
||||
|
|
@ -53,63 +32,19 @@ func _physics_process(delta: float) -> void:
|
|||
|
||||
held_object.angular_velocity = axis * angle * PlayerConsts.GRAB_ROTATION_POWER
|
||||
|
||||
func handle_joypad_movement(delta: float):
|
||||
var controller_look_vector = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50
|
||||
|
||||
if controller_look_vector.length() > 0:
|
||||
mouse_motion += controller_look_vector
|
||||
mouse_motion_delta = controller_look_vector
|
||||
|
||||
func equip_object(object: RigidBody3D):
|
||||
player_manager.add_item(object)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not player_state.in_menu:
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
#so it doesnt yank
|
||||
if event.relative.length() > 400:
|
||||
return
|
||||
|
||||
mouse_motion += event.relative
|
||||
mouse_motion_delta = event.relative
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("open_menu"):
|
||||
ui_handler.toggle_menu()
|
||||
|
||||
if !Console.toggled and not player_state.in_menu:
|
||||
handle_joypad_movement(delta)
|
||||
|
||||
if Input.is_action_just_pressed("next_item"):
|
||||
player_manager.next_item()
|
||||
|
||||
if Input.is_action_just_pressed("prev_item"):
|
||||
player_manager.prev_item()
|
||||
UiManager.toggle_in_game_menu()
|
||||
|
||||
if !Console.toggled and not UiManager.in_game_menu.visible:
|
||||
if Input.is_action_just_pressed("show_debug_menu"):
|
||||
debug_menu.visible = !debug_menu.visible
|
||||
|
||||
if Input.is_action_just_pressed("select_item_1"):
|
||||
player_manager.select_item(0)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_2"):
|
||||
player_manager.select_item(1)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_3"):
|
||||
player_manager.select_item(2)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_4"):
|
||||
player_manager.select_item(3)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_5"):
|
||||
player_manager.select_item(4)
|
||||
UiManager.toggle_debug_menu()
|
||||
|
||||
if Input.is_action_just_pressed("flashlight"):
|
||||
toggle_flashlight()
|
||||
toggle_flashlight.emit()
|
||||
|
||||
if Input.is_action_just_released("jump") or Input.is_action_just_released("sprint"):
|
||||
stamina_reset.start()
|
||||
stamina_reset.emit()
|
||||
|
||||
if Input.is_action_just_pressed("grab"):
|
||||
if cursor_raycast.is_colliding():
|
||||
|
|
@ -126,20 +61,3 @@ func _process(delta: float) -> void:
|
|||
held_object.angular_damp = 0.0
|
||||
held_object = null
|
||||
prompt.visible = true
|
||||
|
||||
if Input.is_action_just_pressed("equip"):
|
||||
if cursor_raycast.is_colliding():
|
||||
var hit_object = cursor_raycast.get_collider()
|
||||
|
||||
if hit_object is RigidBody3D and hit_object.is_in_group("equippable"):
|
||||
equip_object(hit_object)
|
||||
|
||||
if Input.is_action_just_pressed("drop"):
|
||||
player_manager.drop_item()
|
||||
|
||||
#func _unhandled_input(event: InputEvent) -> void:
|
||||
#if event is InputEventMouseMotion:
|
||||
#player_camera.rotate_y(-event.relative.x * sensitivity)
|
||||
#player_camera.rotate_x(-event.relative.y * sensitivity)
|
||||
#player_camera.rotation.x = clamp(player_camera.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
||||
#player_camera.rotation.z = 0
|
||||
|
|
|
|||
134
scenes/player/inventory_component.gd
Normal file
134
scenes/player/inventory_component.gd
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
class_name InventoryComponent extends Node
|
||||
|
||||
var selected_item: int = 0
|
||||
var prev_selected_item: int = 0
|
||||
var selected_item_object: EquippableItem = null
|
||||
var inventory: Array[EquippableItem] = [null,null]
|
||||
|
||||
@export var equipped_item_mesh: MeshInstance3D
|
||||
@export var hold_position: Marker3D
|
||||
@export var cursor_raycast: RayCast3D
|
||||
|
||||
signal select_item(index: int)
|
||||
|
||||
#for ui elements
|
||||
signal add_item(index: int, item: EquippableItem)
|
||||
signal remove_item
|
||||
|
||||
func next_item():
|
||||
prev_selected_item = selected_item
|
||||
if selected_item + 1 > len(inventory) - 1:
|
||||
selected_item = 0
|
||||
else:
|
||||
selected_item += 1
|
||||
_select_item()
|
||||
|
||||
func prev_item():
|
||||
prev_selected_item = selected_item
|
||||
if selected_item - 1 < 0:
|
||||
selected_item = len(inventory) - 1
|
||||
else:
|
||||
selected_item -= 1
|
||||
_select_item()
|
||||
|
||||
func _select_item(index:int = selected_item):
|
||||
if index >= 0 and index < len(inventory):
|
||||
select_item.emit(index)
|
||||
|
||||
if inventory[index] == null:
|
||||
#if current index is empty in the inventory, replace held object with placeholder (empty mesh)
|
||||
equipped_item_mesh.mesh = PlaceholderMesh.new()
|
||||
else:
|
||||
var mesh = null
|
||||
for i in inventory[index].get_children():
|
||||
if i is MeshInstance3D:
|
||||
equipped_item_mesh.mesh = i.mesh
|
||||
|
||||
func _add_item(item: EquippableItem):
|
||||
#add item to current equipped slot if empty
|
||||
if inventory[selected_item] == null:
|
||||
inventory[selected_item] = item
|
||||
|
||||
add_item.emit(selected_item, item)
|
||||
|
||||
#ui.add_item(selected_item, item)
|
||||
item.reparent(get_parent().get_parent())
|
||||
item.collision_layer = 0
|
||||
item.visible = false
|
||||
_select_item(selected_item)
|
||||
return
|
||||
|
||||
#add item to first empty slot if currently equipped slot is full
|
||||
for i in range(0, len(inventory)):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = item
|
||||
|
||||
add_item.emit(i, item)
|
||||
#ui.add_item(i, item)
|
||||
item.reparent(get_parent().get_parent())
|
||||
item.collision_layer = 0
|
||||
item.visible = false
|
||||
return
|
||||
|
||||
#dont equip item if inventory full
|
||||
|
||||
func _drop_item(index: int = selected_item):
|
||||
if inventory[index] != null:
|
||||
var object = inventory[index]
|
||||
|
||||
object.scale = Vector3.ONE
|
||||
|
||||
if object.is_inside_tree():
|
||||
object.reparent(get_tree().current_scene, true)
|
||||
|
||||
object.collision_layer = 17
|
||||
object.global_position = hold_position.global_position
|
||||
object.visible = true
|
||||
object.global_rotation = Vector3.ZERO
|
||||
|
||||
_remove_item(index)
|
||||
|
||||
func _remove_item(index: int):
|
||||
#ui.remove_item(index)
|
||||
remove_item.emit(index)
|
||||
inventory[index] = null
|
||||
_select_item(index)
|
||||
|
||||
func get_selected_item() -> EquippableItem:
|
||||
return inventory[selected_item]
|
||||
|
||||
func _ready() -> void:
|
||||
get_tree().create_timer(0.1).timeout.connect(func (): _select_item(0))
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not Console.toggled and not UiManager.in_game_menu.visible:
|
||||
if Input.is_action_just_pressed("next_item"):
|
||||
next_item()
|
||||
|
||||
if Input.is_action_just_pressed("prev_item"):
|
||||
prev_item()
|
||||
|
||||
if Input.is_action_just_pressed("select_item_1"):
|
||||
_select_item(0)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_2"):
|
||||
_select_item(1)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_3"):
|
||||
_select_item(2)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_4"):
|
||||
_select_item(3)
|
||||
|
||||
if Input.is_action_just_pressed("select_item_5"):
|
||||
_select_item(4)
|
||||
|
||||
if Input.is_action_just_pressed("equip"):
|
||||
if cursor_raycast.is_colliding():
|
||||
var hit_object = cursor_raycast.get_collider()
|
||||
|
||||
if hit_object is EquippableItem:
|
||||
_add_item(hit_object)
|
||||
|
||||
if Input.is_action_just_pressed("drop"):
|
||||
_drop_item()
|
||||
1
scenes/player/inventory_component.gd.uid
Normal file
1
scenes/player/inventory_component.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://2mpqfiofksnu
|
||||
|
|
@ -1,28 +1,57 @@
|
|||
extends Node
|
||||
class_name MovementComponent extends Node
|
||||
|
||||
@onready var camera_pivot: Node3D = %CameraPivot
|
||||
@onready var player_camera: Camera3D = %PlayerCamera
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var player_state: Node = %PlayerState
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
@onready var procedural_camera_mover: Node = %ProceduralCameraMover
|
||||
@onready var player_hit_box: CollisionShape3D = $"../../PlayerHitBox"
|
||||
@onready var sound_controller: Node = %SoundController
|
||||
@onready var ui: Control = %PlayerUi
|
||||
@export var camera_pivot: Node3D
|
||||
@export var player_camera: Camera3D
|
||||
@export var player: Player
|
||||
@export var player_hit_box: CollisionShape3D
|
||||
@export var player_state: Node
|
||||
|
||||
var mouse_motion: Vector2 = Vector2.ZERO
|
||||
var mouse_motion_delta: Vector2 = Vector2.ZERO
|
||||
|
||||
signal jumped
|
||||
|
||||
func jump():
|
||||
player.velocity.y = PlayerConsts.JUMP_VELOCITY
|
||||
player.stamina_component.stamina -= PlayerConsts.JUMP_STAMINA_COST
|
||||
jumped.emit()
|
||||
|
||||
func handle_joypad_movement():
|
||||
var controller_look_vector = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50
|
||||
|
||||
if controller_look_vector.length() > 0:
|
||||
mouse_motion += controller_look_vector
|
||||
mouse_motion_delta = controller_look_vector
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not UiManager.in_game_menu.visible:
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
#so it doesnt yank
|
||||
if event.relative.length() > 400:
|
||||
return
|
||||
|
||||
mouse_motion += event.relative
|
||||
mouse_motion_delta = event.relative
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("jump") and player.is_on_floor() and player.stamina_component.stamina > PlayerConsts.JUMP_STAMINA_COST:
|
||||
jump()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not Console.toggled or not UiManager.in_game_menu.visible:
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
player.transform.basis = lerp(player.transform.basis, Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0)), delta * 30)
|
||||
player_camera.transform.basis = lerp(player_camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 30)
|
||||
handle_joypad_movement()
|
||||
|
||||
if not player.is_on_floor():
|
||||
player.velocity += player.get_gravity() * delta
|
||||
|
||||
if not player_state.in_menu and not Console.toggled:
|
||||
if Input.is_action_just_pressed("jump") and player.is_on_floor() and player_manager.stamina > PlayerConsts.JUMP_STAMINA_COST:
|
||||
player.velocity.y = PlayerConsts.JUMP_VELOCITY
|
||||
player_manager.stamina -= PlayerConsts.JUMP_STAMINA_COST
|
||||
player_manager.stamina_recharge_off()
|
||||
if not UiManager.in_game_menu.visible and not Console.toggled:
|
||||
|
||||
var input_dir = Input.get_vector("left", "right", "forward", "backward")
|
||||
#var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
|
|
@ -46,11 +75,11 @@ func _physics_process(delta: float) -> void:
|
|||
player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 2, delta * 10)
|
||||
player_state.is_crouched(false)
|
||||
|
||||
if Input.is_action_pressed("sprint") and player_manager.stamina > 0:
|
||||
if Input.is_action_pressed("sprint") and player.stamina_component.stamina > 0:
|
||||
target_speed *= PlayerConsts.SPRINT_MULTIPLIER
|
||||
player_state.is_running(true)
|
||||
player_manager.stamina -= delta * PlayerConsts.SPRINT_STAMINA_COST
|
||||
player_manager.stamina_recharge_off()
|
||||
player.stamina_component.stamina -= delta * PlayerConsts.SPRINT_STAMINA_COST
|
||||
GlobalSignals.stamina_recharge_off.emit()
|
||||
else:
|
||||
player_state.is_running(false)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,36 @@
|
|||
extends CharacterBody3D
|
||||
class_name Player extends CharacterBody3D
|
||||
|
||||
@onready var camera = %PlayerCamera
|
||||
@onready var ui: PlayerUI = %PlayerUi
|
||||
@onready var prompt: Control = %Prompt
|
||||
|
||||
@export_category("Components")
|
||||
@export var stamina_component: StaminaComponent
|
||||
@export var flashlight_component: FlashlightComponent
|
||||
@export var inventory_component: InventoryComponent
|
||||
@export var movement_component: MovementComponent
|
||||
@export var input_controller: InputController
|
||||
@export var procedural_animator: ProceduralAnimator
|
||||
@export var sound_controller: SoundController
|
||||
@export var player_state: PlayerState
|
||||
|
||||
#var player_properties: PlayerProperties = PlayerProperties.new()
|
||||
|
||||
func _ready() -> void:
|
||||
Console.context["player"] = self
|
||||
GameState.player = self
|
||||
|
||||
#signal connections
|
||||
inventory_component.select_item.connect(ui.select_item)
|
||||
inventory_component.add_item.connect(ui.add_item)
|
||||
inventory_component.remove_item.connect(ui.remove_item)
|
||||
|
||||
procedural_animator.breath.connect(sound_controller.play_breath_sound)
|
||||
procedural_animator.footstep.connect(sound_controller.play_footstep_sound)
|
||||
|
||||
input_controller.stamina_reset.connect(stamina_component.restart_timer)
|
||||
input_controller.toggle_flashlight.connect(flashlight_component.toggle_flashlight)
|
||||
input_controller.toggle_flashlight.connect(sound_controller.play_flashlight_sound)
|
||||
|
||||
movement_component.jumped.connect(func():sound_controller.play_jump_sound(true))
|
||||
player_state.landed.connect(func():sound_controller.play_jump_sound(false))
|
||||
|
|
|
|||
|
|
@ -2,79 +2,105 @@
|
|||
|
||||
[ext_resource type="Script" uid="uid://bawpnca3v51gv" path="res://scenes/player/player.gd" id="1_76ube"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsccbqq04umeg" path="res://scenes/player/player_ui.tscn" id="2_rkbax"]
|
||||
[ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://scenes/player/in_game_menu.tscn" id="3_g1dw6"]
|
||||
[ext_resource type="PackedScene" uid="uid://c57oxgn18vrdv" path="res://scenes/player/debug_menu.tscn" id="12_gx1jg"]
|
||||
[ext_resource type="Script" uid="uid://2mpqfiofksnu" path="res://scenes/player/inventory_component.gd" id="10_ugbui"]
|
||||
[ext_resource type="Script" uid="uid://dntoi54g4hqce" path="res://scenes/player/flashlight_component.gd" id="11_myrg7"]
|
||||
[ext_resource type="Script" uid="uid://cdfis3askl3gb" path="res://scenes/player/stamina_component.gd" id="12_kvlxm"]
|
||||
[ext_resource type="PackedScene" uid="uid://c02fkimxlbrje" path="res://scenes/player/prompt.tscn" id="13_ugbui"]
|
||||
[ext_resource type="Script" uid="uid://dr2lwciaohf6f" path="res://scenes/player/movement_component.gd" id="60_s3g0c"]
|
||||
[ext_resource type="Script" uid="uid://cjk6a0da11ge6" path="res://scenes/player/procedural_camera_mover_component.gd" id="61_hggc2"]
|
||||
[ext_resource type="Script" uid="uid://cjk6a0da11ge6" path="res://scenes/player/procedural_animator.gd" id="61_hggc2"]
|
||||
[ext_resource type="Script" uid="uid://v8er7yn0hdh8" path="res://scenes/player/sound_controller_component.gd" id="62_b2j0d"]
|
||||
[ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="62_jbx34"]
|
||||
[ext_resource type="Script" uid="uid://7aa26wi66kqq" path="res://scenes/player/ui_handler_component.gd" id="63_7l6ig"]
|
||||
[ext_resource type="Script" uid="uid://7aa26wi66kqq" path="res://scenes/player/prompt_handler.gd" id="63_7l6ig"]
|
||||
[ext_resource type="Script" uid="uid://bvvwwkswavy5x" path="res://scenes/player/input_controller_component.gd" id="64_j3r50"]
|
||||
[ext_resource type="Script" uid="uid://7hmwhf7acwpj" path="res://scenes/player/state_handler_component.gd" id="65_kssj8"]
|
||||
[ext_resource type="Script" uid="uid://cbdvyelf7nb1u" path="res://scenes/player/player_manager.gd" id="66_8lfxt"]
|
||||
[ext_resource type="AudioStream" uid="uid://0q6nhlhgnxu2" path="res://assets/sounds/whitenoise.mp3" id="204_76ube"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"]
|
||||
|
||||
[sub_resource type="PlaceholderMesh" id="PlaceholderMesh_60a4j"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_b5l5s"]
|
||||
[sub_resource type="PlaceholderMesh" id="PlaceholderMesh_b5l5s"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_g4v7s"]
|
||||
radius = 0.04638672
|
||||
|
||||
[sub_resource type="Curve" id="Curve_3gngh"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="Curve" id="Curve_fcnqv"]
|
||||
_data = [Vector2(0.6145833, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="Curve" id="Curve_7numd"]
|
||||
_data = [Vector2(0.6145833, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_d0u6y"]
|
||||
curve_x = SubResource("Curve_3gngh")
|
||||
curve_y = SubResource("Curve_fcnqv")
|
||||
curve_z = SubResource("Curve_7numd")
|
||||
|
||||
[node name="Player" type="CharacterBody3D" unique_id=423228143]
|
||||
[node name="Player" type="CharacterBody3D" unique_id=423228143 node_paths=PackedStringArray("stamina_component", "flashlight_component", "inventory_component", "movement_component", "input_controller", "procedural_animator", "sound_controller", "player_state") groups=["player"]]
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
script = ExtResource("1_76ube")
|
||||
stamina_component = NodePath("Components/StaminaComponent")
|
||||
flashlight_component = NodePath("Components/FlashlightComponent")
|
||||
inventory_component = NodePath("Components/InventoryComponent")
|
||||
movement_component = NodePath("Components/MovementComponent")
|
||||
input_controller = NodePath("Components/InputController")
|
||||
procedural_animator = NodePath("Components/ProceduralAnimator")
|
||||
sound_controller = NodePath("Components/SoundController")
|
||||
player_state = NodePath("Components/PlayerState")
|
||||
|
||||
[node name="Components" type="Node" parent="." unique_id=1652812621]
|
||||
|
||||
[node name="Movement" type="Node" parent="Components" unique_id=1821617467]
|
||||
[node name="MovementComponent" type="Node" parent="Components" unique_id=1821617467 node_paths=PackedStringArray("camera_pivot", "player_camera", "player", "player_hit_box", "player_state")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("60_s3g0c")
|
||||
camera_pivot = NodePath("../../CameraPivot")
|
||||
player_camera = NodePath("../../CameraPivot/PlayerCamera")
|
||||
player = NodePath("../..")
|
||||
player_hit_box = NodePath("../../PlayerHitBox")
|
||||
player_state = NodePath("../PlayerState")
|
||||
|
||||
[node name="ProceduralCameraMover" type="Node" parent="Components" unique_id=899836528]
|
||||
[node name="ProceduralAnimator" type="Node" parent="Components" unique_id=899836528 node_paths=PackedStringArray("player", "camera", "ui", "movement")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("61_hggc2")
|
||||
player = NodePath("../..")
|
||||
camera = NodePath("../../CameraPivot/PlayerCamera")
|
||||
ui = NodePath("../../PlayerUi")
|
||||
movement = NodePath("../MovementComponent")
|
||||
|
||||
[node name="SoundController" type="Node" parent="Components" unique_id=1286506274]
|
||||
[node name="SoundController" type="Node" parent="Components" unique_id=1286506274 node_paths=PackedStringArray("player_state", "player", "movement", "left_foot", "right_foot", "right_foot_texture", "left_foot_texture", "head", "head_texture", "wind")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("62_b2j0d")
|
||||
player_state = NodePath("../PlayerState")
|
||||
player = NodePath("../..")
|
||||
movement = NodePath("../MovementComponent")
|
||||
left_foot = NodePath("../../SoundEmitters/LeftFoot")
|
||||
right_foot = NodePath("../../SoundEmitters/RightFoot")
|
||||
right_foot_texture = NodePath("../../SoundEmitters/RightFoot/RightFootTexture")
|
||||
left_foot_texture = NodePath("../../SoundEmitters/LeftFoot/LeftFootTexture")
|
||||
head = NodePath("../../CameraPivot/Head")
|
||||
head_texture = NodePath("../../CameraPivot/Head/HeadTexture")
|
||||
wind = NodePath("../../SoundEmitters/Wind")
|
||||
|
||||
[node name="UiHandler" type="Node" parent="Components" unique_id=1264775993]
|
||||
[node name="PromptHandler" type="Node" parent="Components" unique_id=1264775993 node_paths=PackedStringArray("prompt", "player")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("63_7l6ig")
|
||||
prompt = NodePath("../../Prompt")
|
||||
player = NodePath("../..")
|
||||
|
||||
[node name="InputController" type="Node" parent="Components" unique_id=1680856401]
|
||||
[node name="InputController" type="Node" parent="Components" unique_id=1680856401 node_paths=PackedStringArray("cursor_raycast", "prompt", "player", "hold_position")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("64_j3r50")
|
||||
cursor_raycast = NodePath("../../CameraPivot/PlayerCamera/CursorRaycast")
|
||||
prompt = NodePath("../../Prompt")
|
||||
player = NodePath("../..")
|
||||
hold_position = NodePath("../../CameraPivot/PlayerCamera/HoldPosition")
|
||||
|
||||
[node name="PlayerState" type="Node" parent="Components" unique_id=1564123661]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("65_kssj8")
|
||||
|
||||
[node name="PlayerManager" type="Node" parent="Components" unique_id=1984191860]
|
||||
[node name="InventoryComponent" type="Node" parent="Components" unique_id=1980833408 node_paths=PackedStringArray("equipped_item_mesh", "hold_position", "cursor_raycast")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("66_8lfxt")
|
||||
script = ExtResource("10_ugbui")
|
||||
equipped_item_mesh = NodePath("../../CameraPivot/PlayerCamera/EquippedItemMesh")
|
||||
hold_position = NodePath("../../CameraPivot/PlayerCamera/HoldPosition")
|
||||
cursor_raycast = NodePath("../../CameraPivot/PlayerCamera/CursorRaycast")
|
||||
|
||||
[node name="FlashlightComponent" type="Node" parent="Components" unique_id=952221781 node_paths=PackedStringArray("flashlight")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("11_myrg7")
|
||||
flashlight = NodePath("../../CameraPivot/PlayerCamera/Flashlight")
|
||||
|
||||
[node name="StaminaComponent" type="Node" parent="Components" unique_id=2000384295]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("12_kvlxm")
|
||||
|
||||
[node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228]
|
||||
shape = SubResource("CapsuleShape3D_g4v7s")
|
||||
|
|
@ -120,20 +146,10 @@ target_position = Vector3(0, -2, 0)
|
|||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
|
||||
|
||||
[node name="EquippedItemPosition" type="StaticBody3D" parent="CameraPivot/PlayerCamera" unique_id=273241291]
|
||||
[node name="EquippedItemMesh" type="MeshInstance3D" parent="CameraPivot/PlayerCamera" unique_id=825894473]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5698267)
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
|
||||
[node name="EquippedItemMesh" type="MeshInstance3D" parent="CameraPivot/PlayerCamera/EquippedItemPosition" unique_id=1561364797]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, -0.2449894, 0.8769744)
|
||||
mesh = SubResource("PlaceholderMesh_60a4j")
|
||||
|
||||
[node name="EquippedItemCollision" type="CollisionShape3D" parent="CameraPivot/PlayerCamera/EquippedItemPosition" unique_id=492114455]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, -0.2449894, 0.8769744)
|
||||
shape = SubResource("SphereShape3D_b5l5s")
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.4, -0.30000004, -0.7)
|
||||
mesh = SubResource("PlaceholderMesh_b5l5s")
|
||||
|
||||
[node name="GrabbableFinder" type="Area3D" parent="CameraPivot/PlayerCamera" unique_id=988433915]
|
||||
|
||||
|
|
@ -154,34 +170,10 @@ current = true
|
|||
[node name="PlayerUi" parent="." unique_id=454848358 instance=ExtResource("2_rkbax")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="InGameMenu" parent="." unique_id=1952418949 instance=ExtResource("3_g1dw6")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="DebugMenu" parent="." unique_id=890382686 instance=ExtResource("12_gx1jg")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="Prompt" parent="." unique_id=318901794 instance=ExtResource("13_ugbui")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="." unique_id=1574569435]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.49
|
||||
anchor_top = 0.49
|
||||
anchor_right = 0.51
|
||||
anchor_bottom = 0.51
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Cursor" type="TextureRect" parent="AspectRatioContainer" unique_id=785138925]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_transform_scale = Vector2(0.345, 0.345)
|
||||
texture = SubResource("CurveXYZTexture_d0u6y")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="StaminaReset" type="Timer" parent="." unique_id=1815815085]
|
||||
unique_name_in_owner = true
|
||||
wait_time = 3.0
|
||||
|
|
@ -223,11 +215,11 @@ reverb_fadeintime = -1.0
|
|||
reverb_fadeouttime = -1.0
|
||||
metadata/_custom_type_script = "uid://y8x4svl5kej2"
|
||||
|
||||
[node name="Wind" type="AudioStreamPlayer" parent="SoundEmitters" unique_id=1598731400]
|
||||
[node name="Wind" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1950929206]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7, 0)
|
||||
stream = ExtResource("204_76ube")
|
||||
bus = &"wind"
|
||||
|
||||
[connection signal="body_entered" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/UiHandler" method="_on_action_finder_body_entered"]
|
||||
[connection signal="body_exited" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/UiHandler" method="_on_action_finder_body_exited"]
|
||||
[connection signal="timeout" from="StaminaReset" to="Components/PlayerManager" method="_on_stamina_reset_timeout"]
|
||||
[connection signal="body_entered" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/PromptHandler" method="_on_action_finder_body_entered"]
|
||||
[connection signal="body_exited" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/PromptHandler" method="_on_action_finder_body_exited"]
|
||||
|
|
|
|||
|
|
@ -2,98 +2,7 @@ extends Node
|
|||
|
||||
var stamina: float = 100.0
|
||||
var flashlight_power: float = 100.0
|
||||
var selected_item: int = 0
|
||||
var prev_selected_item: int = 0
|
||||
var stamina_recharge: bool = true
|
||||
var inventory: Array[RigidBody3D] = [null,null]
|
||||
|
||||
@onready var ui: Control = %PlayerUi
|
||||
@onready var flashlight: SpotLight3D = %Flashlight
|
||||
@onready var equipped_item_mesh: MeshInstance3D = %EquippedItemMesh
|
||||
@onready var hold_position: Marker3D = %HoldPosition
|
||||
|
||||
var selected_item_object: RigidBody3D = null
|
||||
|
||||
func next_item():
|
||||
prev_selected_item = selected_item
|
||||
if selected_item + 1 > len(inventory) - 1:
|
||||
selected_item = 0
|
||||
else:
|
||||
selected_item += 1
|
||||
select_item()
|
||||
|
||||
func prev_item():
|
||||
prev_selected_item = selected_item
|
||||
if selected_item - 1 < 0:
|
||||
selected_item = len(inventory) - 1
|
||||
else:
|
||||
selected_item -= 1
|
||||
select_item()
|
||||
|
||||
func select_item(index:int = selected_item):
|
||||
if index >= 0 and index < len(inventory):
|
||||
ui.select_item(index)
|
||||
|
||||
if inventory[index] == null:
|
||||
#if current index is empty in the inventory, replace held object with placeholder (empty mesh)
|
||||
equipped_item_mesh.mesh = PlaceholderMesh.new()
|
||||
else:
|
||||
var mesh = null
|
||||
for i in inventory[index].get_children():
|
||||
if i is MeshInstance3D:
|
||||
equipped_item_mesh.mesh = i.mesh
|
||||
|
||||
func add_item(item: RigidBody3D):
|
||||
#add item to current equipped slot if empty
|
||||
if inventory[selected_item] == null:
|
||||
inventory[selected_item] = item
|
||||
ui.add_item(selected_item, item)
|
||||
item.reparent(get_parent().get_parent())
|
||||
item.collision_layer = 0
|
||||
item.visible = false
|
||||
select_item(selected_item)
|
||||
return
|
||||
|
||||
#add item to first empty slot if currently equipped slot is full
|
||||
for i in range(0, len(inventory)):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = item
|
||||
ui.add_item(i, item)
|
||||
item.reparent(get_parent().get_parent())
|
||||
item.collision_layer = 0
|
||||
item.visible = false
|
||||
return
|
||||
|
||||
#dont equip item if inventory full
|
||||
|
||||
func drop_item(index: int = selected_item):
|
||||
if inventory[index] != null:
|
||||
var object = inventory[index]
|
||||
|
||||
object.scale = Vector3.ONE
|
||||
|
||||
if object.is_inside_tree():
|
||||
object.reparent(get_tree().current_scene, true)
|
||||
|
||||
object.collision_layer = 17
|
||||
object.add_to_group("equippable")
|
||||
object.global_position = hold_position.global_position
|
||||
object.visible = true
|
||||
object.global_rotation = Vector3.ZERO
|
||||
|
||||
for child in object.get_children():
|
||||
if child is CollisionObject3D:
|
||||
child.add_to_group("equippable")
|
||||
|
||||
remove_item(index)
|
||||
|
||||
func remove_item(index: int):
|
||||
inventory[index] = null
|
||||
select_item(index)
|
||||
ui.remove_item(index)
|
||||
|
||||
func get_selected_item() -> RigidBody3D:
|
||||
return inventory[selected_item]
|
||||
|
||||
func stamina_recharge_off():
|
||||
stamina_recharge = false
|
||||
|
|
@ -101,9 +10,6 @@ func stamina_recharge_off():
|
|||
func _on_stamina_reset_timeout() -> void:
|
||||
stamina_recharge = true
|
||||
|
||||
func _ready() -> void:
|
||||
get_tree().create_timer(0.1).timeout.connect(func (): select_item(0))
|
||||
|
||||
#func _physics_process(_delta: float) -> void:
|
||||
##handle equipped object
|
||||
#if selected_item_object != null:
|
||||
|
|
@ -124,9 +30,3 @@ func _ready() -> void:
|
|||
#angle -= TAU
|
||||
#
|
||||
#selected_item_object.angular_velocity = axis * angle * PlayerConsts.GRAB_ROTATION_POWER
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if stamina_recharge:
|
||||
stamina = move_toward(stamina, 100, 10 * delta)
|
||||
if flashlight.visible:
|
||||
flashlight_power = move_toward(flashlight_power, 0, .2 * delta)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
extends Control
|
||||
class_name PlayerUI extends Control
|
||||
|
||||
@onready var stamina_bar: ProgressBar = %StaminaBar
|
||||
@onready var flashlight_bar: ProgressBar = %FlashlightBar
|
||||
|
||||
@onready var inventory_slots_panels: Array[TextureRect] = [%InvSlot1, %InvSlot2, %InvSlot3, %InvSlot4, %InvSlot5]
|
||||
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
var inventory_size: int = 2
|
||||
|
||||
## returns true if successful
|
||||
func add_inventory_slot() -> bool:
|
||||
if len(player_manager.inventory) < 5:
|
||||
player_manager.inventory.append(null)
|
||||
var aspect = %InventoryPanels.get_child(len(player_manager.inventory) - 1)
|
||||
if aspect is AspectRatioContainer:
|
||||
aspect.visible = true
|
||||
if inventory_size < 4:
|
||||
inventory_slots_panels[inventory_size - 1].get_parent().visible = true
|
||||
inventory_slots_panels[inventory_size - 1].texture = null
|
||||
inventory_size += 1
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func add_inventory_slot_console():
|
||||
|
|
@ -21,12 +22,11 @@ func add_inventory_slot_console():
|
|||
|
||||
## returns true if successful
|
||||
func remove_inventory_slot() -> bool:
|
||||
if len(player_manager.inventory) > 2:
|
||||
var aspect = %InventoryPanels.get_child(len(player_manager.inventory) - 1)
|
||||
if aspect is AspectRatioContainer:
|
||||
aspect.visible = false
|
||||
player_manager.inventory.remove_at(len(player_manager.inventory) - 1)
|
||||
if inventory_size > 2:
|
||||
inventory_slots_panels[inventory_size - 1].get_parent().visible = false
|
||||
inventory_size -= 1
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func remove_inventory_slot_console():
|
||||
|
|
@ -46,14 +46,14 @@ func _ready():
|
|||
Console.remove_inventory.connect(remove_inventory_slot_console)
|
||||
|
||||
func select_item(index):
|
||||
if index >= 0 and index < len(player_manager.inventory):
|
||||
if index >= 0 and index < inventory_size:
|
||||
for i in inventory_slots_panels:
|
||||
i.get_parent().add_theme_stylebox_override("panel", unselected_stylebox)
|
||||
if index >= 0 and index < len(player_manager.inventory):
|
||||
if index >= 0 and index < inventory_size:
|
||||
inventory_slots_panels[index].get_parent().add_theme_stylebox_override("panel", selected_stylebox)
|
||||
|
||||
func add_item(index: int, object: RigidBody3D):
|
||||
if index >= 0 and index < len(player_manager.inventory):
|
||||
if index >= 0 and index < inventory_size:
|
||||
var meshes = object.get_children()
|
||||
var texture = null
|
||||
for i in meshes:
|
||||
|
|
@ -62,10 +62,18 @@ func add_item(index: int, object: RigidBody3D):
|
|||
inventory_slots_panels[index].texture = texture
|
||||
|
||||
func remove_item(index: int):
|
||||
if index >= 0 and index < len(player_manager.inventory):
|
||||
if index >= 0 and index < inventory_size:
|
||||
inventory_slots_panels[index].texture = null
|
||||
|
||||
var stamina: float = 100.0
|
||||
var flashlight: float = 100.0
|
||||
|
||||
func set_stamina(value:float):
|
||||
stamina = value
|
||||
|
||||
func set_flashlight(value:float):
|
||||
flashlight = value
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if player_manager != null:
|
||||
stamina_bar.value = lerpf(stamina_bar.value, player_manager.stamina, delta * 5)
|
||||
flashlight_bar.value = lerpf(flashlight_bar.value, player_manager.flashlight_power, delta * 5)
|
||||
stamina_bar.value = lerpf(stamina_bar.value, stamina, delta * 5)
|
||||
flashlight_bar.value = lerpf(flashlight_bar.value, flashlight, delta * 5)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://bsccbqq04umeg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://lkb0o8too0mj" path="res://scenes/player/ui_manager_scene.gd" id="1_32d7b"]
|
||||
[ext_resource type="Script" uid="uid://lkb0o8too0mj" path="res://scenes/player/player_ui.gd" id="1_32d7b"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m6sn8"]
|
||||
bg_color = Color(0.23921569, 0.23921569, 0.23921569, 0.47058824)
|
||||
|
|
@ -8,6 +8,23 @@ bg_color = Color(0.23921569, 0.23921569, 0.23921569, 0.47058824)
|
|||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b5l5s"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_3gngh"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="Curve" id="Curve_fcnqv"]
|
||||
_data = [Vector2(0.6145833, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="Curve" id="Curve_7numd"]
|
||||
_data = [Vector2(0.6145833, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 1
|
||||
|
||||
[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_32d7b"]
|
||||
curve_x = SubResource("Curve_3gngh")
|
||||
curve_y = SubResource("Curve_fcnqv")
|
||||
curve_z = SubResource("Curve_7numd")
|
||||
|
||||
[node name="PlayerUi" type="Control" unique_id=454848358]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -182,3 +199,20 @@ custom_minimum_size = Vector2(0, 50)
|
|||
layout_mode = 2
|
||||
offset_transform_enabled = true
|
||||
show_percentage = false
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="." unique_id=1864185410]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.49
|
||||
anchor_top = 0.49
|
||||
anchor_right = 0.51
|
||||
anchor_bottom = 0.51
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Cursor" type="TextureRect" parent="AspectRatioContainer" unique_id=417293523]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_transform_scale = Vector2(0.345, 0.345)
|
||||
texture = SubResource("CurveXYZTexture_32d7b")
|
||||
expand_mode = 1
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
extends Node
|
||||
class_name ProceduralAnimator extends Node
|
||||
|
||||
@export var player: Player
|
||||
@export var camera: Camera3D
|
||||
@export var ui: Control
|
||||
@export var movement: Node
|
||||
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var sound_controller: Node = %SoundController
|
||||
@onready var camera: Camera3D = %PlayerCamera
|
||||
@onready var ui: Control = %PlayerUi
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
@onready var ui_base_position = ui.position
|
||||
@onready var ui_handler: Node = %UiHandler
|
||||
@onready var player_state: Node = %PlayerState
|
||||
@onready var input_controller: Node = %InputController
|
||||
|
||||
|
||||
var t_bob: float = 0.0
|
||||
var last_bob_y: float = 0.0
|
||||
|
|
@ -20,17 +16,26 @@ var target_rotation: Vector3 = Vector3.ZERO
|
|||
var _last_camera_global_position: Vector3 = Vector3.ZERO
|
||||
var _breathing: bool = true
|
||||
|
||||
#signals for emitting sounds
|
||||
signal footstep
|
||||
signal breath(breathe_in:bool)
|
||||
|
||||
func _ready() -> void:
|
||||
_last_camera_global_position = camera.global_position
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if player.is_on_floor():
|
||||
_breathing = true
|
||||
else:
|
||||
_breathing = false
|
||||
func _physics_process(_delta: float) -> void:
|
||||
camera.rotation += target_rotation
|
||||
|
||||
footstep_sound()
|
||||
breathing_sound()
|
||||
func _process(delta: float) -> void:
|
||||
if not UiManager.in_game_menu.visible:
|
||||
do(delta)
|
||||
if player.is_on_floor():
|
||||
_breathing = true
|
||||
else:
|
||||
_breathing = false
|
||||
|
||||
footstep_sound()
|
||||
breathing_sound()
|
||||
|
||||
func do(delta):
|
||||
ui.offset_transform_scale *= PlayerConsts.UI_SCALE
|
||||
|
|
@ -39,7 +44,7 @@ func do(delta):
|
|||
var horizontal_speed = Vector3(player.velocity.x, player.velocity.y, player.velocity.z).length()
|
||||
|
||||
if _breathing:
|
||||
t_breath += delta * (100 / (40 + player_manager.stamina))
|
||||
t_breath += delta * (100 / (40 + player.stamina_component.stamina))
|
||||
|
||||
var target_pos = get_breathing_bob_offset_pos()
|
||||
var target_rot = get_breathing_bob_offset_rot()
|
||||
|
|
@ -55,12 +60,12 @@ func do(delta):
|
|||
var final_pitch = target_rot.x
|
||||
var final_roll = target_rot.z
|
||||
|
||||
var target_basis = Basis.from_euler(Vector3(final_pitch, 0, final_roll))
|
||||
#var target_basis = Basis.from_euler(Vector3(final_pitch, 0, final_roll))
|
||||
|
||||
target_rotation = Vector3(final_pitch, 0, final_roll)
|
||||
|
||||
func ui_movement_handling(delta: float):
|
||||
var mouse_offset = -input_controller.mouse_motion_delta * PlayerConsts.UI_MOVEMENT_SENSITIVITY
|
||||
var mouse_offset = -movement.mouse_motion_delta * PlayerConsts.UI_MOVEMENT_SENSITIVITY
|
||||
|
||||
var current_camera_global_position = camera.global_position
|
||||
var camera_global_velocity = (current_camera_global_position - _last_camera_global_position) / delta
|
||||
|
|
@ -88,7 +93,7 @@ func footstep_sound():
|
|||
var current_sin_pos = sin(t_bob * PlayerConsts.CAMERA_BOB_FREQUENCY)
|
||||
|
||||
if last_bob_y >= -.95 and current_sin_pos < -.95:
|
||||
sound_controller.play_footstep_sound()
|
||||
footstep.emit()
|
||||
|
||||
last_bob_y = current_sin_pos
|
||||
|
||||
|
|
@ -97,10 +102,10 @@ func breathing_sound():
|
|||
var current_sin_pos = sin(t_breath * PlayerConsts.CAMERA_BOB_FREQUENCY)
|
||||
|
||||
if last_breath_y <= -.60 and current_sin_pos > -.60:
|
||||
sound_controller.play_breath_sound(true)
|
||||
breath.emit(true)
|
||||
|
||||
if last_breath_y >= .60 and current_sin_pos < .60:
|
||||
sound_controller.play_breath_sound(false)
|
||||
breath.emit(false)
|
||||
|
||||
last_breath_y = current_sin_pos
|
||||
|
||||
28
scenes/player/prompt_handler.gd
Normal file
28
scenes/player/prompt_handler.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
extends Node
|
||||
|
||||
@export var prompt: Node
|
||||
@export var player: Player
|
||||
|
||||
var action_panel_body = null
|
||||
|
||||
func _on_action_finder_body_entered(body: Node3D) -> void:
|
||||
if body != null:
|
||||
if body.is_in_group("grabbable"):
|
||||
prompt.change_text("[LMB] to grab")
|
||||
elif body is EquippableItem:
|
||||
prompt.change_text("[R] to equip")
|
||||
else:
|
||||
return
|
||||
action_panel_body = body
|
||||
prompt.position = -(get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)) / 2
|
||||
prompt.visible = true
|
||||
|
||||
func _on_action_finder_body_exited(body: Node3D) -> void:
|
||||
if body != null and body == action_panel_body:
|
||||
action_panel_body = null
|
||||
prompt.visible = false
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if action_panel_body != null:
|
||||
var target_position = get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)
|
||||
prompt.position = prompt.position.lerp(-target_position / 2, delta * 50)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
extends Node
|
||||
class_name SoundController extends Node
|
||||
|
||||
#@export_category("Audio")
|
||||
#@export var NORMAL_FOOTSTEP_SOUNDS: Array[AudioStream] ##normal footsteps -- walking
|
||||
|
|
@ -40,17 +40,17 @@ var _current_breath_in_sound = null
|
|||
var _current_breath_out_sound = null
|
||||
var _current_leg_is_right = false
|
||||
|
||||
@onready var player_state: Node = %PlayerState
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var input_controller: Node = %InputController
|
||||
@export var player_state: Node
|
||||
@export var player: CharacterBody3D
|
||||
@export var movement: Node
|
||||
|
||||
@onready var left_foot: SpatialAudio3D = %LeftFoot
|
||||
@onready var right_foot: SpatialAudio3D = %RightFoot
|
||||
@onready var right_foot_texture: SpatialAudio3D = %RightFootTexture
|
||||
@onready var left_foot_texture: SpatialAudio3D = %LeftFootTexture
|
||||
@onready var head: SpatialAudio3D = %Head
|
||||
@onready var head_texture: SpatialAudio3D = %HeadTexture
|
||||
@onready var wind: AudioStreamPlayer = %Wind
|
||||
@export var left_foot: SpatialAudio3D
|
||||
@export var right_foot: SpatialAudio3D
|
||||
@export var right_foot_texture: SpatialAudio3D
|
||||
@export var left_foot_texture: SpatialAudio3D
|
||||
@export var head: SpatialAudio3D
|
||||
@export var head_texture: SpatialAudio3D
|
||||
@export var wind: AudioStreamPlayer3D
|
||||
|
||||
var audio_cooldowns = {
|
||||
"left_foot": 0,
|
||||
|
|
@ -87,6 +87,8 @@ func _ready() -> void:
|
|||
player_state.landed.connect(play_jump_sound)
|
||||
player_state.jumped.connect(play_jump_sound)
|
||||
|
||||
GlobalSignals.toggle_flashlight.connect(play_flashlight_sound)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if audio_cooldowns != null:
|
||||
for i in audio_cooldowns:
|
||||
|
|
@ -195,6 +197,9 @@ func play_jump_sound(start:bool = true):
|
|||
var volume:float = 1.0
|
||||
|
||||
##TODO: make the landing sound volume scale with the fallen height (the higher you fall from, the bigger the stomp)
|
||||
##TODO: find out why tf is it being called 2x????????
|
||||
|
||||
print("play_jump_sound", start)
|
||||
|
||||
match start:
|
||||
true:
|
||||
|
|
@ -246,7 +251,7 @@ func init_wind():
|
|||
|
||||
func play_wind():
|
||||
var strength = player.velocity.length() * 10 + abs(player.velocity.y) * 15
|
||||
var mouse_strength = input_controller.mouse_motion_delta.length() * 5
|
||||
var mouse_strength = movement.mouse_motion_delta.length() * 5
|
||||
|
||||
if wind_filter is AudioEffectFilter:
|
||||
wind_filter.cutoff_hz = strength / 2 + mouse_strength / 10 + wind_strength
|
||||
|
|
|
|||
24
scenes/player/stamina_component.gd
Normal file
24
scenes/player/stamina_component.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class_name StaminaComponent extends Node
|
||||
|
||||
var stamina_recharge: bool = true
|
||||
var stamina: float = 100.0
|
||||
|
||||
## how many seconds to wait for stamina recharge
|
||||
@export var stamina_recharge_cooldown: float = 3.0
|
||||
|
||||
var _timer: Timer = Timer.new()
|
||||
|
||||
func restart_timer():
|
||||
_timer.start()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if stamina_recharge:
|
||||
stamina = move_toward(stamina, 100, 10 * delta)
|
||||
|
||||
func _ready() -> void:
|
||||
_timer.wait_time = stamina_recharge_cooldown
|
||||
_timer.autostart = false
|
||||
_timer.timeout.connect(func (): stamina_recharge = true)
|
||||
add_child(_timer)
|
||||
|
||||
GlobalSignals.stamina_recharge_off.connect(restart_timer)
|
||||
1
scenes/player/stamina_component.gd.uid
Normal file
1
scenes/player/stamina_component.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cdfis3askl3gb
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
extends Node
|
||||
class_name PlayerState extends Node
|
||||
|
||||
var walking: bool = false
|
||||
var running: bool = false
|
||||
var crouching: bool = false
|
||||
var in_menu: bool = false
|
||||
@onready var in_menu: bool = UiManager.in_game_menu.visible
|
||||
var breathing_mode = breath.calm
|
||||
|
||||
enum breath {
|
||||
|
|
@ -23,15 +23,14 @@ enum breath {
|
|||
## 80 -- 100 --> calm
|
||||
var _breath_change_points: Array[float] = [10, 20, 50, 80]
|
||||
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var player: Player = $"../.."
|
||||
|
||||
var flying: bool = false
|
||||
signal landed
|
||||
signal jumped
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var stamina = player_manager.stamina
|
||||
var stamina = player.stamina_component.stamina
|
||||
if stamina == 0:
|
||||
breathing_mode = breath.exhausted
|
||||
elif stamina <= _breath_change_points[0]:
|
||||
|
|
@ -46,11 +45,11 @@ func _process(_delta: float) -> void:
|
|||
breathing_mode = breath.calm
|
||||
|
||||
if !player.is_on_floor() and !flying:
|
||||
emit_signal("jumped", true)
|
||||
jumped.emit()
|
||||
flying = true
|
||||
|
||||
if player.is_on_floor() and flying:
|
||||
emit_signal("landed", false)
|
||||
landed.emit()
|
||||
flying = false
|
||||
|
||||
func is_crouched(yes:bool):
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
extends Node
|
||||
|
||||
@export_category("UI")
|
||||
@export var UI_SCALE: float = 1 ##rational scale of the ui
|
||||
@export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera
|
||||
@export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera
|
||||
@export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing
|
||||
|
||||
@onready var prompt: Node = %Prompt
|
||||
@onready var in_game_menu: Control = %InGameMenu
|
||||
@onready var ui: Control = %PlayerUi
|
||||
@onready var player_state: Node = %PlayerState
|
||||
@onready var player_manager: Node = %PlayerManager
|
||||
@onready var player: CharacterBody3D = $"../.."
|
||||
@onready var cursor: TextureRect = %Cursor
|
||||
@onready var player_camera: Camera3D = %PlayerCamera
|
||||
|
||||
const SELECTED_COLOR = 0xcfcfcf78
|
||||
const UNSELECTED_COLOR = 0x3d3d3d78
|
||||
|
||||
var action_panel_body = null
|
||||
|
||||
func _on_action_finder_body_entered(body: Node3D) -> void:
|
||||
if body != null:
|
||||
if body.is_in_group("grabbable"):
|
||||
prompt.change_text("[LMB] to grab")
|
||||
elif body.is_in_group("equippable"):
|
||||
prompt.change_text("[R] to equip")
|
||||
else:
|
||||
return
|
||||
action_panel_body = body
|
||||
prompt.position = -(cursor.global_position - player_camera.unproject_position(action_panel_body.global_position)) / 2
|
||||
prompt.visible = true
|
||||
|
||||
func _on_action_finder_body_exited(body: Node3D) -> void:
|
||||
if body != null and body == action_panel_body:
|
||||
action_panel_body = null
|
||||
prompt.visible = false
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if action_panel_body != null:
|
||||
var target_position = cursor.global_position - player_camera.unproject_position(action_panel_body.global_position)
|
||||
prompt.position = prompt.position.lerp(-target_position / 2, delta * 50)
|
||||
|
||||
func toggle_menu():
|
||||
if !in_game_menu.visible:
|
||||
ui.visible = false
|
||||
in_game_menu.visible = true
|
||||
cursor.visible = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
player_state.in_menu = true
|
||||
prompt.visible = false
|
||||
else:
|
||||
ui.visible = true
|
||||
in_game_menu.visible = false
|
||||
cursor.visible = true
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
player_state.in_menu = false
|
||||
if action_panel_body != null:
|
||||
prompt.visible = true
|
||||
|
||||
func set_ui_scale(scale:float) -> void:
|
||||
pass
|
||||
17
scenes/ui/ui_manager.gd
Normal file
17
scenes/ui/ui_manager.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Control
|
||||
|
||||
@onready var in_game_menu: Control = %InGameMenu
|
||||
@onready var debug_menu: Control = %DebugMenu
|
||||
|
||||
func toggle_debug_menu():
|
||||
debug_menu.visible = !debug_menu.visible
|
||||
|
||||
func toggle_in_game_menu():
|
||||
in_game_menu.visible = !in_game_menu.visible
|
||||
|
||||
if in_game_menu.visible:
|
||||
GameState.player.ui.visible = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
else:
|
||||
GameState.player.ui.visible = true
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
1
scenes/ui/ui_manager.gd.uid
Normal file
1
scenes/ui/ui_manager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://33wtl3qa013n
|
||||
24
scenes/ui/ui_manager.tscn
Normal file
24
scenes/ui/ui_manager.tscn
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[gd_scene format=3 uid="uid://dtrfb3xosj32r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://33wtl3qa013n" path="res://scenes/ui/ui_manager.gd" id="1_b2463"]
|
||||
[ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://scenes/player/in_game_menu.tscn" id="2_js4l8"]
|
||||
[ext_resource type="PackedScene" uid="uid://c57oxgn18vrdv" path="res://scenes/player/debug_menu.tscn" id="3_61ox6"]
|
||||
|
||||
[node name="UIManager" type="Control" unique_id=585290585]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_b2463")
|
||||
|
||||
[node name="InGameMenu" parent="." unique_id=1952418949 instance=ExtResource("2_js4l8")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="DebugMenu" parent="." unique_id=890382686 instance=ExtResource("3_61ox6")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
3
scripts/autoload/game_state.gd
Normal file
3
scripts/autoload/game_state.gd
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
extends Node
|
||||
|
||||
@onready var player: CharacterBody3D = null
|
||||
1
scripts/autoload/game_state.gd.uid
Normal file
1
scripts/autoload/game_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://drxx0ny7uim8k
|
||||
20
scripts/autoload/global_signals.gd
Normal file
20
scripts/autoload/global_signals.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
extends Node
|
||||
|
||||
@warning_ignore("unused_signal")
|
||||
signal next_item
|
||||
@warning_ignore("unused_signal")
|
||||
signal prev_item
|
||||
@warning_ignore("unused_signal")
|
||||
signal select_item(index:int)
|
||||
@warning_ignore("unused_signal")
|
||||
signal drop_item(index:int)
|
||||
@warning_ignore("unused_signal")
|
||||
signal remove_item(index:int)
|
||||
@warning_ignore("unused_signal")
|
||||
signal add_item(item: EquippableItem)
|
||||
|
||||
@warning_ignore("unused_signal")
|
||||
signal stamina_recharge_off
|
||||
|
||||
@warning_ignore("unused_signal")
|
||||
signal toggle_flashlight
|
||||
1
scripts/autoload/global_signals.gd.uid
Normal file
1
scripts/autoload/global_signals.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cky5rk5obojex
|
||||
Loading…
Reference in a new issue