diff --git a/Scenes/Actors/hacking_player.tscn b/Scenes/Actors/hacking_player.tscn new file mode 100644 index 00000000..7dced904 --- /dev/null +++ b/Scenes/Actors/hacking_player.tscn @@ -0,0 +1,614 @@ +[gd_scene load_steps=91 format=3 uid="uid://dyfdmymh8anuc"] + +[ext_resource type="Script" uid="uid://d2ubk5gucny6s" path="res://Scripts/Components/FSM/PlayerFSMProxy.cs" id="1_4ux7c"] +[ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="2_tm0j0"] +[ext_resource type="Script" uid="uid://chwqogny2v8t1" path="res://Scripts/Components/FSM/Player/Init.cs" id="3_1ryx5"] +[ext_resource type="Script" uid="uid://bw53r8yy0xw0y" path="res://Scripts/Components/FSM/Player/Hacking/HackingActive.cs" id="4_4ux7c"] +[ext_resource type="Script" uid="uid://dn2rrgw3e027b" path="res://Scripts/Components/FSM/Player/Cutscene.cs" id="5_60mev"] +[ext_resource type="Script" uid="uid://b0khv2fcrgm6t" path="res://Scripts/Components/FSM/Player/Teleporting.cs" id="6_t22op"] +[ext_resource type="Script" uid="uid://br2ev58gwuvu4" path="res://Scripts/Components/FSM/Player/UnTeleporting.cs" id="7_i7jye"] +[ext_resource type="Script" uid="uid://bwtcgcvfw8urt" path="res://Scripts/Components/FSM/Player/Controlling.cs" id="8_o705v"] +[ext_resource type="Script" uid="uid://bo6xcjnw3yn6s" path="res://Scripts/Components/FSM/Player/Dead.cs" id="9_8wpl5"] +[ext_resource type="Script" uid="uid://bgve2lktony00" path="res://Scripts/Components/FSM/Player/Drowning.cs" id="10_og808"] +[ext_resource type="Texture2D" uid="uid://cvngivvogv17l" path="res://Sprites/Actors/Cirno-Shadow.png" id="11_v3a7t"] +[ext_resource type="Material" uid="uid://dnvwgyt2tbqmr" path="res://Resources/Materials/Player_Blink_Teleport_Material.tres" id="12_1ajy7"] +[ext_resource type="SpriteFrames" uid="uid://c6exoa8pxbc6w" path="res://Resources/Sprites/player_float.tres" id="13_uaaqj"] +[ext_resource type="SpriteFrames" uid="uid://byb4cbb23cawf" path="res://Resources/Sprites/player_float_legs.tres" id="14_5sbc6"] +[ext_resource type="Script" uid="uid://b4nixnxhj5qhw" path="res://Scripts/Components/Actors/PlayerWeaponProvider.cs" id="15_cnvkg"] +[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="16_vbx5j"] +[ext_resource type="Script" uid="uid://bo5sgbv1t8ril" path="res://Scripts/Components/Actors/PlayerAnimationProvider.cs" id="17_jace2"] +[ext_resource type="PackedScene" uid="uid://biugfbp0yae2s" path="res://Scenes/Particles/DeathParticles.tscn" id="18_3esyb"] +[ext_resource type="Script" uid="uid://dq338w2lw5phl" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="19_peplf"] +[ext_resource type="Script" uid="uid://d208gvthkstvc" path="res://Scripts/Components/Actors/PlayerCrosshairProvider.cs" id="20_07a8k"] +[ext_resource type="Texture2D" uid="uid://cf2855sd3hqty" path="res://Sprites/Actors/Aiming_Reticule_Small.png" id="21_lvqam"] +[ext_resource type="Script" uid="uid://3jxrxcqp3ndr" path="res://Scripts/Components/Actors/PlayerHitboxSpriteProvider.cs" id="22_te01o"] +[ext_resource type="Texture2D" uid="uid://bwjrdlnysft15" path="res://Sprites/Actors/Focus_Circle.png" id="23_sfg2a"] +[ext_resource type="Texture2D" uid="uid://bc4tp44e00g0d" path="res://Sprites/Actors/Focus_Square.png" id="24_1rmrb"] +[ext_resource type="Texture2D" uid="uid://bf37ce6jskdel" path="res://Sprites/SmallHitbox.png" id="25_1sr0y"] +[ext_resource type="Script" uid="uid://dkmsw828qwikk" path="res://Scripts/Components/Actors/PlayerDamageReceiver.cs" id="26_ujjoc"] +[ext_resource type="Script" uid="uid://ddsqqfx1usc3j" path="res://Scripts/Resources/DamageResistance.cs" id="27_w72vq"] +[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="28_q7408"] +[ext_resource type="Script" uid="uid://dv205x8msohpv" path="res://Scripts/Components/Actors/ActivationProvider.cs" id="29_o6ys2"] +[ext_resource type="PackedScene" uid="uid://chkpk7erlqajg" path="res://Scenes/Selector.tscn" id="30_dvi24"] +[ext_resource type="AudioStream" uid="uid://myr6n2c1u503" path="res://SFX/581602__samsterbirdies__beep-error.mp3" id="31_rhlct"] +[ext_resource type="Script" uid="uid://cem7a1agaqtrt" path="res://Scenes/InteractionController.cs" id="32_0n0fl"] +[ext_resource type="Script" uid="uid://d0bebi2vn171l" path="res://Scripts/Components/FSM/Player/PlayerFSMItemUseModule.cs" id="33_xmnee"] +[ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="34_cuh31"] +[ext_resource type="Script" uid="uid://camgjo4302qmq" path="res://Scripts/Components/Actors/ConveyorBeltMover.cs" id="35_3m8ud"] +[ext_resource type="Script" uid="uid://dbxbvjonbtib2" path="res://Scripts/Components/FSM/Player/PlayerStorageModule.cs" id="36_w1w0q"] +[ext_resource type="Script" uid="uid://bcpn47j3lr1tg" path="res://Scripts/Components/FSM/Player/DeathItemDropper.cs" id="37_u5fs4"] +[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="38_pi8x4"] +[ext_resource type="Resource" uid="uid://cvlwye1u5gv8u" path="res://Resources/Items/Green_Points_Pickup.tres" id="39_5wdss"] +[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="40_ycit3"] +[ext_resource type="Resource" uid="uid://dy53gia1tmkah" path="res://Resources/Items/Points_Pickup.tres" id="41_27fjn"] +[ext_resource type="Resource" uid="uid://clr1gln7nxa1o" path="res://Resources/Items/Power_Pickup.tres" id="42_glaxh"] +[ext_resource type="Script" uid="uid://c8f4tbcjcfsu1" path="res://Scripts/Components/FSM/Player/AutoPickupModule.cs" id="43_v6f8s"] +[ext_resource type="Script" uid="uid://d2r5eh3wn16bg" path="res://Scripts/Components/FSM/Player/PlayerGrazingModule.cs" id="44_hqd7v"] +[ext_resource type="Script" uid="uid://ru6yajru35t0" path="res://Scripts/Components/FSM/Player/FreezeModule.cs" id="45_o75kk"] +[ext_resource type="PackedScene" uid="uid://ckfhlsboy6mfr" path="res://Scenes/Weapons/Bullets/Ice.tscn" id="46_u1x4p"] +[ext_resource type="AudioStream" uid="uid://dgp2e6cqb7i2q" path="res://SFX/Chiptone_Source/Cirno_Hurt.wav" id="47_rjely"] +[ext_resource type="Script" uid="uid://c1cjjk0ghptyx" path="res://Scripts/Components/FSM/Player/HurtSoundPlayer.cs" id="48_51ts2"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_b3hxm"] +radius = 5.0 + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_0pqs8"] +particle_flag_disable_z = true +emission_shape = 2 +emission_sphere_radius = 16.0 +orbit_velocity_min = -1.0 +orbit_velocity_max = 1.098 +gravity = Vector3(0, 0, 0) +color = Color(0.0392157, 0.380392, 1, 1) + +[sub_resource type="AtlasTexture" id="AtlasTexture_12erk"] +atlas = ExtResource("21_lvqam") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_n5ijo"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_12erk") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_n5ijo"] +atlas = ExtResource("23_sfg2a") +region = Rect2(0, 0, 32, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_igu66"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_n5ijo") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_vwjki"] +atlas = ExtResource("24_1rmrb") +region = Rect2(0, 0, 32, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_g3wua"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_vwjki") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_igu66"] +atlas = ExtResource("25_1sr0y") +region = Rect2(0, 0, 4, 4) + +[sub_resource type="SpriteFrames" id="SpriteFrames_5qlss"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_igu66") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="Resource" id="Resource_c4ide"] +script = ExtResource("27_w72vq") +DamageType = 0 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_fjg1v"] +script = ExtResource("27_w72vq") +DamageType = 1 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_hed00"] +script = ExtResource("27_w72vq") +DamageType = 2 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_q2flx"] +script = ExtResource("27_w72vq") +DamageType = 3 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_k7ckg"] +script = ExtResource("27_w72vq") +DamageType = 4 +Attribute = 4 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_qlmfy"] +script = ExtResource("27_w72vq") +DamageType = 5 +Attribute = 4 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_v2m0j"] +script = ExtResource("27_w72vq") +DamageType = 0 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_awrib"] +script = ExtResource("27_w72vq") +DamageType = 1 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_nfrn8"] +script = ExtResource("27_w72vq") +DamageType = 2 +Attribute = 2 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_nfq4p"] +script = ExtResource("27_w72vq") +DamageType = 3 +Attribute = 1 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_m1iep"] +script = ExtResource("27_w72vq") +DamageType = 0 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_ckpe7"] +script = ExtResource("27_w72vq") +DamageType = 4 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="Resource" id="Resource_p5rkw"] +script = ExtResource("27_w72vq") +DamageType = 5 +Attribute = 0 +metadata/_custom_type_script = "uid://ddsqqfx1usc3j" + +[sub_resource type="CircleShape2D" id="CircleShape2D_igu66"] +radius = 2.23607 + +[sub_resource type="CircleShape2D" id="CircleShape2D_7n10g"] +radius = 17.2627 + +[sub_resource type="CircleShape2D" id="CircleShape2D_g3wua"] +radius = 9.0 + +[sub_resource type="AnimationNodeTransition" id="AnimationNodeTransition_es1gk"] +input_0/name = "up" +input_0/auto_advance = false +input_0/break_loop_at_end = false +input_0/reset = true +input_1/name = "down" +input_1/auto_advance = false +input_1/break_loop_at_end = false +input_1/reset = true +input_2/name = "left" +input_2/auto_advance = false +input_2/break_loop_at_end = false +input_2/reset = true +input_3/name = "right" +input_3/auto_advance = false +input_3/break_loop_at_end = false +input_3/reset = true + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4f2wn"] +animation = &"Walk_Down" + +[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_fnw0c"] +blend_point_0/node = SubResource("AnimationNodeAnimation_4f2wn") +blend_point_0/pos = 0.0 + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_12erk"] +animation = &"Walk_Up" + +[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_c4ide"] +blend_point_0/node = SubResource("AnimationNodeAnimation_12erk") +blend_point_0/pos = 0.0 + +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_fjg1v"] +graph_offset = Vector2(-110.364, 39.7151) +nodes/Transition/node = SubResource("AnimationNodeTransition_es1gk") +nodes/Transition/position = Vector2(706.667, 53.3333) +nodes/Walk_Down/node = SubResource("AnimationNodeBlendSpace1D_fnw0c") +nodes/Walk_Down/position = Vector2(426.667, 253.333) +nodes/Walk_Up/node = SubResource("AnimationNodeBlendSpace1D_c4ide") +nodes/Walk_Up/position = Vector2(426.667, 53.3333) +nodes/output/position = Vector2(280, 133.333) +node_connections = [&"Transition", 0, &"Walk_Up", &"Transition", 1, &"Walk_Down"] + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hed00"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_q2flx"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_k7ckg"] +states/BlendTree/node = SubResource("AnimationNodeBlendTree_fjg1v") +states/BlendTree/position = Vector2(401.333, 98.4444) +states/Start/position = Vector2(192, 98.963) +transitions = ["Start", "BlendTree", SubResource("AnimationNodeStateMachineTransition_hed00"), "BlendTree", "End", SubResource("AnimationNodeStateMachineTransition_q2flx")] + +[sub_resource type="Animation" id="Animation_awrib"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} + +[sub_resource type="Animation" id="Animation_qlmfy"] +resource_name = "Walk_Down" +length = 0.3 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [0, 1, 2] +} + +[sub_resource type="Animation" id="Animation_v2m0j"] +resource_name = "Walk_Up" +length = 0.3 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [3, 5, 4] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_nfrn8"] +_data = { +&"RESET": SubResource("Animation_awrib"), +&"Walk_Down": SubResource("Animation_qlmfy"), +&"Walk_Up": SubResource("Animation_v2m0j") +} + +[sub_resource type="CircleShape2D" id="CircleShape2D_fnw0c"] +radius = 2.05679 + +[sub_resource type="CircleShape2D" id="CircleShape2D_qlmfy"] +radius = 3.16228 + +[sub_resource type="CircleShape2D" id="CircleShape2D_awrib"] + +[node name="FSMPlayer" type="CharacterBody2D" node_paths=PackedStringArray("PlayerFSM", "InteractionController")] +process_mode = 1 +collision_layer = 2 +collision_mask = 97 +platform_floor_layers = 4294967294 +platform_wall_layers = 97 +script = ExtResource("1_4ux7c") +PlayerFSM = NodePath("StateMachine") +InteractionController = NodePath("InteractionController") +metadata/_edit_group_ = true + +[node name="StateMachine" type="Node2D" parent="." node_paths=PackedStringArray("MotivationResource", "Shield")] +script = ExtResource("2_tm0j0") +MotivationResource = NodePath("../DamageReceiver/MotivationProvider") +Shield = NodePath("../DamageReceiver/ShieldProvider") + +[node name="Init" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_storageModule")] +script = ExtResource("3_1ryx5") +_animationProvider = NodePath("../../AnimationProvider") +_storageModule = NodePath("../../Storage") + +[node name="Active" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_weaponProvider", "_animationProvider", "_hitboxSpriteProvider", "_inputProvider", "_damageReceiver", "_storageModule", "_moduleNodes")] +script = ExtResource("4_4ux7c") +Speed = 50 +_weaponProvider = NodePath("../../WeaponProvider") +_animationProvider = NodePath("../../AnimationProvider") +_hitboxSpriteProvider = NodePath("../../StrafeSpriteProvider") +_inputProvider = NodePath("../../InputProvider") +_damageReceiver = NodePath("../../DamageReceiver") +_storageModule = NodePath("../../Storage") +_moduleNodes = [NodePath("../../InteractionController"), NodePath("../../ItemUser"), NodePath("../../ConveyorBeltMover"), NodePath("../../AutoPickupModule"), NodePath("../../GrazingModule"), NodePath("../../FreezeModule"), NodePath("../../CrosshairProvider")] + +[node name="Cutscene" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] +script = ExtResource("5_60mev") +_animationProvider = NodePath("../../AnimationProvider") + +[node name="Teleporting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] +script = ExtResource("6_t22op") +_animationProvider = NodePath("../../AnimationProvider") + +[node name="UnTeleporting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] +script = ExtResource("7_i7jye") +_animationProvider = NodePath("../../AnimationProvider") + +[node name="Controlling" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] +script = ExtResource("8_o705v") +_animationProvider = NodePath("../../AnimationProvider") + +[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider", "_motivationProvider")] +script = ExtResource("9_8wpl5") +_animationProvider = NodePath("../../AnimationProvider") +_inputProvider = NodePath("../../InputProvider") +_healthProvider = NodePath("../../DamageReceiver/HealthProvider") +_motivationProvider = NodePath("../../DamageReceiver/MotivationProvider") + +[node name="Drowning" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] +script = ExtResource("10_og808") +_animationProvider = NodePath("../../AnimationProvider") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, 4.89) +shape = SubResource("CircleShape2D_b3hxm") + +[node name="Shadow" type="Sprite2D" parent="."] +modulate = Color(1, 1, 1, 0.372549) +position = Vector2(0, 4) +texture = ExtResource("11_v3a7t") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +material = ExtResource("12_1ajy7") +sprite_frames = ExtResource("13_uaaqj") +animation = &"idle" +autoplay = "idle" + +[node name="Legs" type="AnimatedSprite2D" parent="."] +material = ExtResource("12_1ajy7") +sprite_frames = ExtResource("14_5sbc6") +animation = &"idle" +autoplay = "idle" + +[node name="WeaponProvider" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule", "WeaponRightOffset", "WeaponLeftOffset")] +script = ExtResource("15_cnvkg") +StorageModule = NodePath("../Storage") +WeaponTemplate = ExtResource("16_vbx5j") +WeaponRightOffset = NodePath("RightWeapon") +WeaponLeftOffset = NodePath("LeftWeapon") + +[node name="RightWeapon" type="Marker2D" parent="WeaponProvider"] +position = Vector2(4, 3) + +[node name="LeftWeapon" type="Marker2D" parent="WeaponProvider"] +position = Vector2(-14, 3) + +[node name="AnimationProvider" type="Node2D" parent="." node_paths=PackedStringArray("_animatedSprite", "_shieldParticles")] +script = ExtResource("17_jace2") +_animatedSprite = NodePath("../AnimatedSprite2D") +_deathParticles = ExtResource("18_3esyb") +_shieldParticles = NodePath("ShieldParticles") +BlinkMaterial = ExtResource("12_1ajy7") + +[node name="ShieldParticles" type="GPUParticles2D" parent="AnimationProvider"] +emitting = false +amount = 32 +lifetime = 0.4 +one_shot = true +process_material = SubResource("ParticleProcessMaterial_0pqs8") + +[node name="LegsAnimationProvider" type="Node2D" parent="." node_paths=PackedStringArray("_animatedSprite")] +script = ExtResource("17_jace2") +_animatedSprite = NodePath("../Legs") +BlinkMaterial = ExtResource("12_1ajy7") + +[node name="InputProvider" type="Node2D" parent="."] +script = ExtResource("19_peplf") + +[node name="CrosshairProvider" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule", "AnimatedSprite")] +script = ExtResource("20_07a8k") +StorageModule = NodePath("../Storage") +AnimatedSprite = NodePath("Crosshair") +CrosshairDistance = 35.0 + +[node name="Crosshair" type="AnimatedSprite2D" parent="CrosshairProvider"] +sprite_frames = SubResource("SpriteFrames_n5ijo") + +[node name="StrafeSpriteProvider" type="Node2D" parent="." node_paths=PackedStringArray("Hitbox", "Circle", "Square")] +show_behind_parent = true +script = ExtResource("22_te01o") +Hitbox = NodePath("Hitbox") +Circle = NodePath("MagicCircle") +Square = NodePath("MagicSquare") +RotationSpeed = 1.0 + +[node name="MagicCircle" type="AnimatedSprite2D" parent="StrafeSpriteProvider"] +modulate = Color(1, 1, 1, 0.501961) +sprite_frames = SubResource("SpriteFrames_igu66") + +[node name="MagicSquare" type="AnimatedSprite2D" parent="StrafeSpriteProvider"] +modulate = Color(1, 1, 1, 0.501961) +sprite_frames = SubResource("SpriteFrames_g3wua") + +[node name="Hitbox" type="AnimatedSprite2D" parent="StrafeSpriteProvider"] +z_index = 2 +sprite_frames = SubResource("SpriteFrames_5qlss") + +[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("_healthProvider", "_shieldProvider", "_motivationProvider")] +collision_layer = 2 +collision_mask = 392 +script = ExtResource("26_ujjoc") +_healthProvider = NodePath("HealthProvider") +_shieldProvider = NodePath("ShieldProvider") +_motivationProvider = NodePath("MotivationProvider") +ShieldDamageResistances = Array[ExtResource("27_w72vq")]([SubResource("Resource_c4ide"), SubResource("Resource_fjg1v"), SubResource("Resource_hed00"), SubResource("Resource_q2flx"), SubResource("Resource_k7ckg"), SubResource("Resource_qlmfy")]) +HealthDamageResistances = Array[ExtResource("27_w72vq")]([SubResource("Resource_v2m0j"), SubResource("Resource_awrib"), SubResource("Resource_nfrn8"), SubResource("Resource_nfq4p"), SubResource("Resource_m1iep"), SubResource("Resource_ckpe7"), SubResource("Resource_p5rkw")]) + +[node name="HealthProvider" type="Node2D" parent="DamageReceiver"] +script = ExtResource("28_q7408") +ResourceName = "Health" +_maxResource = 32.0 + +[node name="MotivationProvider" type="Node2D" parent="DamageReceiver"] +script = ExtResource("28_q7408") +ResourceName = "Motivation" +_maxResource = 400.0 + +[node name="ShieldProvider" type="Node2D" parent="DamageReceiver"] +script = ExtResource("28_q7408") +ResourceName = "Shield" +_maxResource = 32.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageReceiver"] +shape = SubResource("CircleShape2D_igu66") + +[node name="InteractionProvider" type="Area2D" parent="." node_paths=PackedStringArray("_inputProvider", "_errorSound")] +visible = false +collision_layer = 0 +collision_mask = 4 +script = ExtResource("29_o6ys2") +SelectorScene = ExtResource("30_dvi24") +_inputProvider = NodePath("../InputProvider") +_errorSound = NodePath("Error") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionProvider"] +visible = false +shape = SubResource("CircleShape2D_7n10g") + +[node name="Error" type="AudioStreamPlayer2D" parent="InteractionProvider"] +stream = ExtResource("31_rhlct") +bus = &"Effects" + +[node name="InteractionController" type="Area2D" parent="." node_paths=PackedStringArray("Health", "Shield")] +visible = false +collision_layer = 2 +collision_mask = 0 +script = ExtResource("32_0n0fl") +Health = NodePath("../DamageReceiver/HealthProvider") +Shield = NodePath("../DamageReceiver/ShieldProvider") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="InteractionController"] +shape = SubResource("CircleShape2D_g3wua") + +[node name="ItemUser" type="Node2D" parent="." node_paths=PackedStringArray("Health", "Shield", "_storageModule")] +script = ExtResource("33_xmnee") +Health = NodePath("../DamageReceiver/HealthProvider") +Shield = NodePath("../DamageReceiver/ShieldProvider") +_storageModule = NodePath("../Storage") + +[node name="Sprite2D" type="Sprite2D" parent="."] +visible = false +texture = ExtResource("34_cuh31") +hframes = 3 +vframes = 4 + +[node name="AnimationTree" type="AnimationTree" parent="."] +root_node = NodePath(".") +tree_root = SubResource("AnimationNodeStateMachine_k7ckg") +anim_player = NodePath("AnimationPlayer") +parameters/BlendTree/Transition/current_state = "" +parameters/BlendTree/Transition/transition_request = "" +parameters/BlendTree/Transition/current_index = -1 +parameters/BlendTree/Walk_Down/blend_position = 0 +parameters/BlendTree/Walk_Up/blend_position = 0 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="AnimationTree"] +libraries = { +&"": SubResource("AnimationLibrary_nfrn8") +} + +[node name="ConveyorBeltMover" type="Area2D" parent="."] +collision_layer = 2 +collision_mask = 512 +script = ExtResource("35_3m8ud") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="ConveyorBeltMover"] +visible = false +position = Vector2(0, 6.48) +shape = SubResource("CircleShape2D_fnw0c") + +[node name="Storage" type="Node2D" parent="." node_paths=PackedStringArray("Root")] +script = ExtResource("36_w1w0q") +Root = NodePath("..") + +[node name="DeathItemDropper" type="Node2D" parent="." node_paths=PackedStringArray("Storage", "HealthProvider")] +script = ExtResource("37_u5fs4") +Storage = NodePath("../Storage") +HealthProvider = NodePath("../DamageReceiver/HealthProvider") +ItemsToDrop = Array[ExtResource("38_pi8x4")]([ExtResource("39_5wdss"), ExtResource("40_ycit3"), ExtResource("41_27fjn"), ExtResource("42_glaxh")]) +DropSpeed = 80.0 + +[node name="AutoPickupModule" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 4 +script = ExtResource("43_v6f8s") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="AutoPickupModule"] +visible = false +shape = SubResource("CircleShape2D_qlmfy") + +[node name="GrazingModule" type="Area2D" parent="." node_paths=PackedStringArray("Shield")] +collision_layer = 0 +collision_mask = 136 +script = ExtResource("44_hqd7v") +Shield = NodePath("../DamageReceiver/ShieldProvider") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="GrazingModule"] +visible = false +shape = SubResource("CircleShape2D_awrib") + +[node name="FreezeModule" type="Node2D" parent="." node_paths=PackedStringArray("Shield", "InputProvider")] +script = ExtResource("45_o75kk") +ResourceCost = 5.0 +IceLife = 2.0 +IceScene = ExtResource("46_u1x4p") +Shield = NodePath("../DamageReceiver/ShieldProvider") +InputProvider = NodePath("../InputProvider") + +[node name="HurtPlayer" type="AudioStreamPlayer2D" parent="." node_paths=PackedStringArray("DamageReceiver")] +stream = ExtResource("47_rjely") +script = ExtResource("48_51ts2") +DamageReceiver = NodePath("../DamageReceiver") + +[connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"] +[connection signal="area_entered" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_entered"] +[connection signal="area_exited" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_exited"] +[connection signal="body_entered" from="ConveyorBeltMover" to="ConveyorBeltMover" method="OnBodyEntered"] +[connection signal="body_exited" from="ConveyorBeltMover" to="ConveyorBeltMover" method="OnBodyExited"] diff --git a/Scenes/Hacking/HackingMinigame.tscn b/Scenes/Hacking/HackingMinigame.tscn new file mode 100644 index 00000000..d6cc2d56 --- /dev/null +++ b/Scenes/Hacking/HackingMinigame.tscn @@ -0,0 +1,107 @@ +[gd_scene load_steps=12 format=4 uid="uid://w0ym1prtes1r"] + +[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="1_50p1n"] +[ext_resource type="PackedScene" uid="uid://dyfdmymh8anuc" path="res://Scenes/Actors/hacking_player.tscn" id="2_gpeiw"] +[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="3_4m6ey"] +[ext_resource type="PackedScene" uid="uid://b4gugris5j5kd" path="res://Scenes/Activable/WallEmitter.tscn" id="3_g5sme"] +[ext_resource type="Resource" uid="uid://dqnvesdj0dk3v" path="res://Resources/Bullets/simple_enemy_bullet.tres" id="4_7t3go"] +[ext_resource type="StyleBox" uid="uid://ctw2hju32l3rg" path="res://Resources/Styles/PixelStyleBoxRed.tres" id="4_qjng3"] +[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="5_g5sme"] +[ext_resource type="Texture2D" uid="uid://c8fr1ea20odaw" path="res://Sprites/Items/Heart_Extend.png" id="6_7t3go"] +[ext_resource type="Texture2D" uid="uid://b2vmpi57d7vwy" path="res://Sprites/Items/Shield_Extend.png" id="7_d7qxa"] + +[sub_resource type="LabelSettings" id="LabelSettings_661u8"] +font = ExtResource("5_g5sme") +font_size = 12 +outline_size = 4 +outline_color = Color(0.000294114, 0.000294114, 0.000294114, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_mhfwn"] +font = ExtResource("5_g5sme") +font_size = 10 +outline_size = 4 +outline_color = Color(0.000294114, 0.000294114, 0.000294114, 1) + +[node name="HackingMinigame" type="Node2D"] + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +tile_map_data = PackedByteArray("AAACAAEABwAGAAYAAAACAAIABwALAAYAAAACAAMABwALAAYAAAACAAQABwALAAYAAAACAAUABwALAAYAAAACAAYABwALAAYAAAADAAEABwAGAAYAAAADAAIABwALAAYAAAADAAMABwAHAAYAAAADAAQABwAHAAYAAAADAAUABwAHAAYAAAADAAYABwAHAAYAAAAEAAEABwAGAAYAAAAEAAIABwALAAYAAAAEAAMABwAHAAYAAAAEAAQABwALAAYAAAAEAAUABwALAAYAAAAEAAYABwALAAYAAAAFAAEABwAGAAYAAAAFAAIABwALAAYAAAAFAAMABwAHAAYAAAAFAAQABwALAAYAAAAFAAUABwAHAAYAAAAFAAYABwAHAAYAAAAGAAEABwAGAAYAAAAGAAIABwALAAYAAAAGAAMABwAHAAYAAAAGAAQABwALAAYAAAAGAAUABwAHAAYAAAAGAAYABwAHAAYAAAAHAAEABwAGAAYAAAAHAAIABwALAAYAAAAHAAMABwAHAAYAAAAHAAQABwALAAYAAAAHAAUABwAHAAYAAAAHAAYABwAHAAYAAAAIAAEABwAGAAYAAAAIAAIABwALAAYAAAAIAAMABwAHAAYAAAAIAAQABwALAAYAAAAIAAUABwAHAAYAAAAIAAYABwAHAAYAAAABAAEABwAGAAYAAAABAAIABwAGAAYAAAABAAMABwAGAAYAAAABAAQABwAGAAYAAAABAAUABwAGAAYAAAABAAYABwAGAAYAAAABAAcABwAGAAYAAAABAAgABwAGAAYAAAABAAkABwAGAAYAAAABAAoABwAGAAYAAAACAAcABwALAAYAAAACAAgABwALAAYAAAACAAkABwALAAYAAAACAAoABwAGAAYAAAADAAcABwAHAAYAAAADAAgABwAHAAYAAAADAAkABwALAAYAAAADAAoABwAGAAYAAAAEAAcABwALAAYAAAAEAAgABwAHAAYAAAAEAAkABwALAAYAAAAEAAoABwAGAAYAAAAFAAcABwALAAYAAAAFAAgABwAHAAYAAAAFAAkABwALAAYAAAAFAAoABwAGAAYAAAAGAAcABwALAAYAAAAGAAgABwAHAAYAAAAGAAkABwALAAYAAAAGAAoABwAGAAYAAAAHAAcABwALAAYAAAAHAAgABwAHAAYAAAAHAAkABwALAAYAAAAHAAoABwAGAAYAAAAIAAcABwALAAYAAAAIAAgABwAHAAYAAAAIAAkABwALAAYAAAAIAAoABwAGAAYAAAA=") +tile_set = ExtResource("1_50p1n") + +[node name="FSMPlayer" parent="." instance=ExtResource("2_gpeiw")] +position = Vector2(88, 104) + +[node name="WallEmitter" parent="." instance=ExtResource("3_g5sme")] +position = Vector2(31, 6) +BulletResource = ExtResource("4_7t3go") +EmitOnStart = true +EmitCoolDown = 0.5 +BurstCoolDown = 0.0 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Panel" type="Panel" parent="CanvasLayer"] +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -126.0 +grow_horizontal = 0 +grow_vertical = 2 +theme = ExtResource("3_4m6ey") +theme_override_styles/panel = ExtResource("4_qjng3") + +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Panel"] +layout_mode = 1 +anchors_preset = 13 +anchor_left = 0.5 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -53.5 +offset_right = 53.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="Label" parent="CanvasLayer/Panel/VBoxContainer"] +layout_mode = 2 +theme_override_constants/line_spacing = -2 +text = "HACKING FAIRY +IN SYSTEM" +label_settings = SubResource("LabelSettings_661u8") +horizontal_alignment = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Panel/VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer"] +layout_mode = 2 +text = "Lives:" +label_settings = SubResource("LabelSettings_mhfwn") + +[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer"] +layout_mode = 2 +texture = ExtResource("6_7t3go") + +[node name="TextureRect2" type="TextureRect" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer"] +layout_mode = 2 +texture = ExtResource("6_7t3go") + +[node name="TextureRect3" type="TextureRect" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer"] +layout_mode = 2 +texture = ExtResource("6_7t3go") + +[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer/Panel/VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +text = "Bombs:" +label_settings = SubResource("LabelSettings_mhfwn") + +[node name="TextureRect4" type="TextureRect" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +texture = ExtResource("7_d7qxa") + +[node name="TextureRect5" type="TextureRect" parent="CanvasLayer/Panel/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +texture = ExtResource("7_d7qxa") diff --git a/Scenes/Maps/PlayerFSMTest.tscn b/Scenes/Maps/PlayerFSMTest.tscn index 0e0d8bbd..c3cdc6af 100644 --- a/Scenes/Maps/PlayerFSMTest.tscn +++ b/Scenes/Maps/PlayerFSMTest.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=132 format=4 uid="uid://dqyfnby0t7gu1"] +[gd_scene load_steps=133 format=4 uid="uid://dqyfnby0t7gu1"] [ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_c3v4x"] -[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_rgw1q"] +[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_g20dv"] [ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="3_6314l"] [ext_resource type="Script" uid="uid://quy4d4tgvqfy" path="res://Scripts/Resources/MapResource.cs" id="4_nadrw"] [ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="4_u1i8n"] @@ -82,11 +82,12 @@ [ext_resource type="Script" uid="uid://upq0b4sx7nhw" path="res://Scripts/Misc/CameraTarget.cs" id="69_nadrw"] [ext_resource type="PackedScene" uid="uid://bmif3jo03yuol" path="res://Scenes/camera_controller.tscn" id="72_vto58"] [ext_resource type="PackedScene" uid="uid://dth038hcu6v1i" path="res://Scenes/Actors/Fairy_SpecialForce_FSM.tscn" id="73_nadrw"] +[ext_resource type="PackedScene" uid="uid://w0ym1prtes1r" path="res://Scenes/Hacking/HackingMinigame.tscn" id="82_rgw1q"] [sub_resource type="Resource" id="Resource_vto58"] script = ExtResource("4_u1i8n") EggIndex = 0 -StartingEquipment = Array[ExtResource("2_rgw1q")]([ExtResource("3_6314l")]) +StartingEquipment = Array[ExtResource("2_g20dv")]([ExtResource("3_6314l")]) RemoveEquipment = [] metadata/_custom_type_script = "uid://mja0rk7n2kln" @@ -293,8 +294,7 @@ metadata/_custom_type_script = "uid://bngko08ho85p6" script = ExtResource("58_rgw1q") relativeTargetPosition = Vector2(60, 0) moveDuration = 2.0 -transitionType = 0 -easeType = 2 +EaseType = 0 WaitForCompletion = false metadata/_custom_type_script = "uid://bgwt0pml2omnf" @@ -359,6 +359,7 @@ BulletScene = ExtResource("60_rgw1q") BulletSpeed = 60.0 Direction = Vector2(1, 0) BulletDamage = 12.0 +MaxDamage = 1.0 Knockback = 1.0 LifeTime = 10.0 DestroyOnCollision = true @@ -402,6 +403,7 @@ BulletScene = ExtResource("60_rgw1q") BulletSpeed = 60.0 Direction = Vector2(1, 0) BulletDamage = 12.0 +MaxDamage = 1.0 Knockback = 1.0 LifeTime = 10.0 DestroyOnCollision = true @@ -476,7 +478,7 @@ TimeModifiers = Array[ExtResource("50_6khjs")]([]) WaitForCompletion = true metadata/_custom_type_script = "uid://c0ndqalsc4jve" -[sub_resource type="Resource" id="Resource_rgw1q"] +[sub_resource type="Resource" id="Resource_okvfm"] resource_local_to_scene = true script = ExtResource("39_83jc5") Patterns = Array[Object]([SubResource("Resource_kuo18")]) @@ -585,7 +587,7 @@ scale = Vector2(0.66, 2.04) [node name="FairyFsm" parent="Tilemaps/AcidHitboxes" node_paths=PackedStringArray("DefeatScript") instance=ExtResource("12_64bae")] position = Vector2(776, -56) -ExtraLoot = Array[ExtResource("13_b3y78")]([SubResource("Resource_w8nwr"), SubResource("Resource_awjkl")]) +ExtraLoot = [SubResource("Resource_w8nwr"), SubResource("Resource_awjkl")] DefeatScript = NodePath("../../Actors/HorizontalForceField2") ActivationType = 2 @@ -710,7 +712,7 @@ position = Vector2(59, 386) [node name="Chest" parent="Tilemaps/Actors" instance=ExtResource("18_v2gcl")] position = Vector2(56, 320) -LootTable = Array[ExtResource("2_rgw1q")]([ExtResource("19_1ajuh"), ExtResource("20_rff8l"), ExtResource("21_cub4j"), ExtResource("22_4gtx8"), ExtResource("3_6314l"), ExtResource("23_1ajuh"), ExtResource("23_1ajuh"), ExtResource("23_1ajuh")]) +LootTable = [ExtResource("19_1ajuh"), ExtResource("20_rff8l"), ExtResource("21_cub4j"), ExtResource("22_4gtx8"), ExtResource("3_6314l"), ExtResource("23_1ajuh"), ExtResource("23_1ajuh"), ExtResource("23_1ajuh")] [node name="Turret360" parent="Tilemaps/Actors" instance=ExtResource("24_rff8l")] position = Vector2(374, 503) @@ -810,7 +812,7 @@ InvertSignal = true [node name="FloorEmitter2" parent="Tilemaps/Actors" instance=ExtResource("44_b8ffn")] position = Vector2(601, 147) -Script = SubResource("Resource_rgw1q") +Script = SubResource("Resource_okvfm") InvertSignal = true [node name="Camera" parent="Tilemaps/Actors" instance=ExtResource("48_r562v")] @@ -916,3 +918,20 @@ visible = false navigation_polygon = SubResource("NavigationPolygon_8qe0x") use_edge_connections = false script = ExtResource("7_nadrw") + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="SubViewportContainer" type="SubViewportContainer" parent="CanvasLayer"] +offset_right = 304.0 +offset_bottom = 168.0 +stretch = true + +[node name="SubViewport" type="SubViewport" parent="CanvasLayer/SubViewportContainer"] +transparent_bg = true +handle_input_locally = false +snap_2d_transforms_to_pixel = true +snap_2d_vertices_to_pixel = true +size = Vector2i(304, 168) +render_target_update_mode = 4 + +[node name="HackingMinigame" parent="CanvasLayer/SubViewportContainer/SubViewport" instance=ExtResource("82_rgw1q")] diff --git a/Scripts/Components/FSM/Player/Hacking/HackingActive.cs b/Scripts/Components/FSM/Player/Hacking/HackingActive.cs new file mode 100644 index 00000000..99ab705b --- /dev/null +++ b/Scripts/Components/FSM/Player/Hacking/HackingActive.cs @@ -0,0 +1,226 @@ +using Cirno.Scripts.Components.Actors; +using Godot; + +namespace Cirno.Scripts.Components.FSM.Player.Hacking; + +public partial class HackingActive : PlayerStateBase +{ + public override PlayerState StateId => PlayerState.Active; + private Vector2 _movementDirection { get; set; } + + public Vector2 FacingDirection + { + get => _storageModule.FacingDirection; + private set => _storageModule.FacingDirection = value; + } + + [Export] public int Speed { get; set; } = 45; + [Export] public int StrafeSpeed { get; set; } = 35; + //[Export] public float Acceleration = 8f; + //[Export] public float Deceleration = 8f; + + [ExportCategory("Providers")] [Export] private PlayerWeaponProvider _weaponProvider; + [Export] private PlayerAnimationProvider _animationProvider; + //[Export] private PlayerCrosshairProvider _crosshairProvider; + [Export] private PlayerHitboxSpriteProvider _hitboxSpriteProvider; + + [Export] private InputProvider _inputProvider; + + [Export] private PlayerDamageReceiver _damageReceiver; + //[Export] private ActivationProvider _activationProvider; + + //[Export] private InteractionController _interactionController; + + [Export] private PlayerStorageModule _storageModule; + + private bool _isStrafing; + + public int MovementSpeed => _isStrafing ? StrafeSpeed : Speed; + + private CharacterBody2D _player; + + //private Hud _hud; + + public override void Init(IStateMachine machine) + { + base.Init(machine); + + //_hud = Hud.Instance; + + _damageReceiver.Death += () => { ChangeState(PlayerState.Dead); }; + + _damageReceiver.HealthDecreased += (value, newValue, maxValue) => + { + _animationProvider.Blink(); + //_hud.UpdateHealth(value, maxValue); + }; + + _damageReceiver.ShieldDecreased += (value, newValue, maxValue) => + { + _animationProvider.PlayShieldAnimation(); + //_hud.UpdateShield(value, maxValue); + }; + + _damageReceiver.Init(StateMachine); + + _damageReceiver.RefillHealth(); + _damageReceiver.RefillShield(); + + //_activationProvider.Init(MainObject); + + _weaponProvider.Init(MainObject); + } + + public override void EnterState() + { + base.EnterState(); + // enable sprite + // enable crosshair + //_crosshairProvider.Show(); + _animationProvider.ShowSprite(); + _damageReceiver.Enabled = true; + //_activationProvider.Enabled = true; + //_interactionController.Enabled = true; + + //_accelerationPerSecond = Speed / Acceleration; + //_decelerationPerSecond = Speed / Deceleration; + } + + public override void ExitState() + { + base.ExitState(); + _animationProvider.SetAnimationSpeed(Vector2.Zero); + //_animationProvider.SetAnimation(Vector2.Zero); + //_crosshairProvider.Hide(); + _hitboxSpriteProvider.Hide(); + + _damageReceiver.Enabled = false; + //_activationProvider.Enabled = false; + //_interactionController.Enabled = false; + } + + //private float _accelerationPerSecond; + //private float _decelerationPerSecond; + + public override void PhysicsProcessState(double delta) + { + // Reset at start of frame + //MainObject.Velocity = Vector2.Zero; + + // Process modules + base.PhysicsProcessState(delta); + + if (_isStrafing) + { + // Instant movement at strafe speed + MainObject.Velocity = _movementDirection * StrafeSpeed; + } + else + { + MainObject.Velocity = _movementDirection * Speed; + + // Vector2 targetVelocity = _movementDirection * Speed; + // + // if (_movementDirection != Vector2.Zero) + // { + // MainObject.Velocity = MainObject.Velocity.MoveToward(targetVelocity, Acceleration * (float)delta); + // } + // else + // { + // MainObject.Velocity = MainObject.Velocity.MoveToward(Vector2.Zero, Deceleration * (float)delta); + // } + } + + //MainObject.Velocity += _movementDirection * MovementSpeed; + + MainObject.MoveAndSlide(); + } + + public override void ProcessState(double delta) + { + base.ProcessState(delta); + + _movementDirection = _inputProvider.GetMovementInput().Normalized(); + _isStrafing = _inputProvider.GetStrafePressed(); + + // Toggle visibility of the hitbox sprite based on strafing + _hitboxSpriteProvider.SetVisibility(_isStrafing); + + //var rightStickInput = _inputProvider.GetAimInput().Normalized(); + + // Update Facing Direction + // if (!_isStrafing) + // { + // if (rightStickInput.Length() > 0.1f) // If the right stick is moved + // { + // FacingDirection = rightStickInput; + // } + // else if (_movementDirection != Vector2.Zero) // Fall back to movement direction + // { + // FacingDirection = _movementDirection; + // } + // } + + FacingDirection = Vector2.Up; + + _animationProvider.SetAnimationSpeed(MainObject.Velocity); + _animationProvider.SetAnimation(FacingDirection); + + //HandleWeaponSwitch(); + _weaponProvider.Update(delta); + + //_crosshairProvider.UpdatePosition(FacingDirection); + + HandleShoot(); + + HandleInteraction(); + // FindInteractable(); + + // _crosshair.Position = CalculateCrosshairPosition(); + + if (_inputProvider.GetInventoryJustPressed()) + { + GameManager.Instance.ChangeState(GameState.Inventory); + } + + if (_inputProvider.GetPauseJustPressed()) + { + //CallDeferred(MethodName.PauseDeferred); + PauseDeferred(); + } + } + + private void PauseDeferred() + { + GameManager.Instance.Pause(); + } + + private void HandleShoot() + { + if (_inputProvider.GetReloadJustPressed()) + { + _weaponProvider.Reload(); + return; + } + + if (!_inputProvider.GetShootPressed()) return; + _weaponProvider.Shoot(this.FacingDirection); + } + + private void HandleInteraction() + { + //_activationProvider.HandleInteraction(); + } + + private void HandleWeaponSwitch() + { + if (_inputProvider.GetWeaponNextJustPressed()) + { + _weaponProvider.NextWeapon(); + } + else if (_inputProvider.GetWeaponPreviousJustPressed()) + { + _weaponProvider.PreviousWeapon(); + } + } +} \ No newline at end of file diff --git a/Scripts/Components/FSM/Player/Hacking/HackingActive.cs.uid b/Scripts/Components/FSM/Player/Hacking/HackingActive.cs.uid new file mode 100644 index 00000000..e43e52ea --- /dev/null +++ b/Scripts/Components/FSM/Player/Hacking/HackingActive.cs.uid @@ -0,0 +1 @@ +uid://bw53r8yy0xw0y