diff --git a/_player/Avatar.tscn b/_player/Avatar.tscn index e5d0bcd..62e075a 100644 --- a/_player/Avatar.tscn +++ b/_player/Avatar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=43 format=3 uid="uid://gwhff4qaouxy"] +[gd_scene load_steps=41 format=3 uid="uid://gwhff4qaouxy"] [ext_resource type="Script" uid="uid://dq1g1qp66chwy" path="res://_player/avatar.gd" id="1_rkqpu"] [ext_resource type="Script" uid="uid://isu8onknb75o" path="res://_player/states/character_state_machine.gd" id="1_wvs5h"] @@ -33,10 +33,8 @@ [ext_resource type="Resource" uid="uid://do0bnwse614jw" path="res://_player/effect_binding/land_dust.tres" id="26_s5egm"] [ext_resource type="Script" uid="uid://bijoqygv6tncj" path="res://addons/reedcomponent/SingleComponentRemotor.gd" id="28_mxt3b"] [ext_resource type="Resource" uid="uid://bdad4yjv1q0uu" path="res://_player/effect_binding/jump_dust.tres" id="30_hquoe"] -[ext_resource type="Script" uid="uid://bhd4nuiu23e7l" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_2d.gd" id="32_ciuu3"] [ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="32_u7cua"] [ext_resource type="Script" uid="uid://bueehfgv5vnc0" path="res://_player/extra/camera_priority_locker.gd" id="34_1a1t3"] -[ext_resource type="Resource" uid="uid://dy1hsviasxfu0" path="res://_shared/camera/camera_shake/base_noise.tres" id="34_01uoa"] [sub_resource type="CircleShape2D" id="CircleShape2D_1a1t3"] radius = 3.0 @@ -197,20 +195,11 @@ script = ExtResource("24_mwlgv") bindings = Array[ExtResource("25_s5egm")]([ExtResource("26_s5egm"), ExtResource("30_hquoe")]) metadata/_custom_type_script = "uid://ta2r2bc1nrwe" -[node name="PhantomCameraNoiseEmitter2D" type="Node2D" parent="."] -unique_name_in_owner = true -script = ExtResource("32_ciuu3") -noise = ExtResource("34_01uoa") -duration = 0.2 -noise_emitter_layer = 0 -metadata/_custom_type_script = "uid://bhd4nuiu23e7l" - [node name="PhantomCamera2D" type="Node2D" parent="."] position = Vector2(50, -75) script = ExtResource("32_u7cua") tween_resource = SubResource("Resource_1a1t3") draw_limits = true -noise = ExtResource("34_01uoa") metadata/_custom_type_script = "uid://bhexx6mj1xv3q" [node name="Locker" type="Node" parent="PhantomCamera2D" node_paths=PackedStringArray("target_camera")] diff --git a/_player/avatar.gd b/_player/avatar.gd index b5198ac..a516d18 100644 --- a/_player/avatar.gd +++ b/_player/avatar.gd @@ -9,9 +9,6 @@ class_name Player extends CharacterBody2D @onready var foot_pos_marker: Marker2D = %FootPosMarker @onready var ground_companion: Area2D = %GroundCompanion -@onready var phantom_camera_noise_emitter_2d: PhantomCameraNoiseEmitter2D = %PhantomCameraNoiseEmitter2D - - enum Direction{LEFT,RIGHT} var direction: Direction = Direction.RIGHT: set = _player_direction_changed diff --git a/_player/states/grapping.gd b/_player/states/grapping.gd index a4425cb..fbba268 100644 --- a/_player/states/grapping.gd +++ b/_player/states/grapping.gd @@ -20,11 +20,23 @@ func _enter() -> void: var tween := get_tree().create_tween() tween.set_ignore_time_scale(true) - tween.tween_property(Engine, "time_scale", .15, .04) - tween.tween_interval(.12) - tween.tween_property(Engine, "time_scale", 1.0, .06) + tween.tween_property(Engine, "time_scale", .25, .03) + tween.tween_interval(.1) + tween.tween_property(Engine, "time_scale", 1.0, .05) - agent.phantom_camera_noise_emitter_2d.emit() + var hook_inst: Hook = agent.spawn_hook_comp.get_current_hook_inst() + if hook_inst: + var i = hook_inst.get_direction_id() + + if i >= 0: + if i == 0 or i == 4: + CameraSystem.get_cached_camera().emit_hook_touch_shock(0) + elif i == 1 or i == 5: + CameraSystem.get_cached_camera().emit_hook_touch_shock(1) + elif i == 2 or i == 6: + CameraSystem.get_cached_camera().emit_hook_touch_shock(2) + elif i == 3 or i == 7: + CameraSystem.get_cached_camera().emit_hook_touch_shock(3) if root.grap_hook_state._jump_grace_timer > 0: _hook_to_jump() diff --git a/_shared/camera/CameraSystem.gd b/_shared/camera/CameraSystem.gd index d5db5f4..d0d6b43 100644 --- a/_shared/camera/CameraSystem.gd +++ b/_shared/camera/CameraSystem.gd @@ -27,6 +27,8 @@ func register_player_camera(owner: Node) -> GlobalCamera: func get_cached_camera() -> GlobalCamera: return _cached_player_camera +func get_player_camera() -> GlobalCamera: + return _cached_player_camera ## 注册一个相机锚点 func register_anchor(anchor: CameraAnchor) -> void: diff --git a/_shared/camera/GlobalCamera.gd b/_shared/camera/GlobalCamera.gd index 6df43ad..ec2b524 100644 --- a/_shared/camera/GlobalCamera.gd +++ b/_shared/camera/GlobalCamera.gd @@ -1,4 +1,24 @@ class_name GlobalCamera extends Node2D @onready var phantom_camera_2d: PhantomCamera2D = %PhantomCamera2D -@onready var phantom_camera_noise_emitter_2d: PhantomCameraNoiseEmitter2D = %PhantomCameraNoiseEmitter2D + +@onready var _0_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"0_Hook_Touch_Noise" +@onready var _45_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"45_Hook_Touch_Noise" +@onready var _90_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"90_Hook_Touch_Noise" +@onready var _135_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"135_Hook_Touch_Noise" + + +func emit_camera_shock(noise: PhantomCameraNoise2D) -> void: + if not noise: + return + +func emit_hook_touch_shock(dir : int) -> void: + match dir: + 0: + _0_hook_touch_noise.emit() + 1: + _45_hook_touch_noise.emit() + 2: + _90_hook_touch_noise.emit() + 3: + _135_hook_touch_noise.emit() diff --git a/_shared/camera/PlayerStaticCamera.tscn b/_shared/camera/PlayerStaticCamera.tscn index 35f1b71..fb6a336 100644 --- a/_shared/camera/PlayerStaticCamera.tscn +++ b/_shared/camera/PlayerStaticCamera.tscn @@ -1,13 +1,47 @@ -[gd_scene load_steps=6 format=3 uid="uid://d1w8ftfhxycfy"] +[gd_scene load_steps=11 format=3 uid="uid://d1w8ftfhxycfy"] [ext_resource type="Script" uid="uid://52tgslofxoi2" path="res://_shared/camera/GlobalCamera.gd" id="1_fixiw"] [ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="1_llsih"] [ext_resource type="Script" uid="uid://bhd4nuiu23e7l" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_2d.gd" id="3_0bl5s"] [ext_resource type="Script" uid="uid://8umksf8e80fw" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="3_fixiw"] +[ext_resource type="Script" uid="uid://dimvdouy8g0sv" path="res://addons/phantom_camera/scripts/resources/phantom_camera_noise_2d.gd" id="6_ctkin"] [sub_resource type="Resource" id="Resource_pvk7k"] script = ExtResource("3_fixiw") +[sub_resource type="Resource" id="Resource_jjeqj"] +script = ExtResource("6_ctkin") +amplitude = 5.0 +frequency = 18.0 +randomize_noise_seed = 1 +noise_seed = 1000 +positional_multiplier_x = 0.0 +positional_multiplier_y = 2.0 +metadata/_custom_type_script = "uid://dimvdouy8g0sv" + +[sub_resource type="Resource" id="Resource_ctkin"] +script = ExtResource("6_ctkin") +amplitude = 5.0 +frequency = 18.0 +randomize_noise_seed = 1 +metadata/_custom_type_script = "uid://dimvdouy8g0sv" + +[sub_resource type="Resource" id="Resource_wjs5j"] +script = ExtResource("6_ctkin") +amplitude = 5.0 +frequency = 18.0 +randomize_noise_seed = 1 +positional_multiplier_x = 2.0 +positional_multiplier_y = 0.0 +metadata/_custom_type_script = "uid://dimvdouy8g0sv" + +[sub_resource type="Resource" id="Resource_ompnq"] +script = ExtResource("6_ctkin") +amplitude = 5.0 +frequency = 18.0 +randomize_noise_seed = 1 +metadata/_custom_type_script = "uid://dimvdouy8g0sv" + [node name="PlayerStaticCamera" type="Node2D"] script = ExtResource("1_fixiw") @@ -19,9 +53,41 @@ zoom = Vector2(0.8, 0.8) tween_resource = SubResource("Resource_pvk7k") tween_on_load = false draw_limits = true +noise_emitter_layer = 1 metadata/_custom_type_script = "uid://bhexx6mj1xv3q" -[node name="PhantomCameraNoiseEmitter2D" type="Node2D" parent="PhantomCamera2D"] +[node name="0_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"] unique_name_in_owner = true script = ExtResource("3_0bl5s") +noise = SubResource("Resource_jjeqj") +growth_time = 0.04095982 +duration = 0.16 +decay_time = 0.10085586 +metadata/_custom_type_script = "uid://bhd4nuiu23e7l" + +[node name="45_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"] +unique_name_in_owner = true +script = ExtResource("3_0bl5s") +noise = SubResource("Resource_ctkin") +growth_time = 0.04096021 +duration = 0.16 +decay_time = 0.10085552 +metadata/_custom_type_script = "uid://bhd4nuiu23e7l" + +[node name="90_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"] +unique_name_in_owner = true +script = ExtResource("3_0bl5s") +noise = SubResource("Resource_wjs5j") +growth_time = 0.0409602 +duration = 0.16 +decay_time = 0.10085564 +metadata/_custom_type_script = "uid://bhd4nuiu23e7l" + +[node name="135_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"] +unique_name_in_owner = true +script = ExtResource("3_0bl5s") +noise = SubResource("Resource_ompnq") +growth_time = 0.040960066 +duration = 0.16 +decay_time = 0.100856625 metadata/_custom_type_script = "uid://bhd4nuiu23e7l" diff --git a/_shared/camera/camera_shake/base_noise.tres b/_shared/camera/camera_shake/base_noise.tres index ed2e364..94c191d 100644 --- a/_shared/camera/camera_shake/base_noise.tres +++ b/_shared/camera/camera_shake/base_noise.tres @@ -7,6 +7,6 @@ script = ExtResource("1_oi7x7") amplitude = 8.0 frequency = 15.0 randomize_noise_seed = 1 -noise_seed = 896 +noise_seed = 608 positional_multiplier_y = 2.0 metadata/_custom_type_script = "uid://dimvdouy8g0sv" diff --git a/addons/limboai/bin/~liblimboai.windows.editor.x86_64.dll b/addons/limboai/bin/~liblimboai.windows.editor.x86_64.dll new file mode 100644 index 0000000..7131bab Binary files /dev/null and b/addons/limboai/bin/~liblimboai.windows.editor.x86_64.dll differ diff --git a/addons/reedcomponent/grap_hook/garpping_hook_v_2.gd b/addons/reedcomponent/grap_hook/garpping_hook_v_2.gd index 0cf1b7d..1f81dbe 100644 --- a/addons/reedcomponent/grap_hook/garpping_hook_v_2.gd +++ b/addons/reedcomponent/grap_hook/garpping_hook_v_2.gd @@ -25,6 +25,8 @@ var _cached_cancel := false var _current_length := 0.0 var _anchor: Node2D +var _dir_id: int = -1 + # ================= # Life Cycle # ================= @@ -48,6 +50,8 @@ func start_stretching(direction: Vector2) -> void: _cached_cancel = false _stretching_dir = direction.normalized() _current_length = 0.0 + + _dir_id = _get_direction_id(direction,8) func end_stretching(force_end: bool = false) -> bool: if not force_end and _is_stretching: @@ -157,3 +161,23 @@ func _create_anchor_on_node(target: Node2D, hit_global_pos: Vector2) -> Node2D: _anchor.position = target.to_local(hit_global_pos) return _anchor + +## 计算方向id,私有 +func _get_direction_id(direction: Vector2, sector_count: int) -> int: + if direction == Vector2.ZERO: + return -1 + + var angle = rad_to_deg(direction.angle()) + + angle += 90.0 + + var sector_size = 360.0 / sector_count + angle += sector_size / 2.0 + + angle = fposmod(angle, 360.0) + + return int(angle / sector_size) + +## 获取方向id +func get_direction_id() -> int: + return _dir_id diff --git a/addons/reedcomponent/grap_hook/spawn_hook_component.gd b/addons/reedcomponent/grap_hook/spawn_hook_component.gd index 600a8c6..2594dfc 100644 --- a/addons/reedcomponent/grap_hook/spawn_hook_component.gd +++ b/addons/reedcomponent/grap_hook/spawn_hook_component.gd @@ -27,6 +27,9 @@ func release_cached_hook() -> void: if _current_grap_hook_inst: _current_grap_hook_inst.release_hook() +func get_current_hook_inst() -> Hook: + return _current_grap_hook_inst + ##尝试关闭hook的延长 func suspend_hook_stretching(force_suspend: bool = false) -> bool: if not _current_grap_hook_inst: return false