mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 07:45:33 +00:00
FSM Selector with sound
This commit is contained in:
parent
f6d159b9c4
commit
ee09c50dbd
20 changed files with 330 additions and 28 deletions
BIN
SFX/581602__samsterbirdies__beep-error.flac
Normal file
BIN
SFX/581602__samsterbirdies__beep-error.flac
Normal file
Binary file not shown.
BIN
SFX/581602__samsterbirdies__beep-error.mp3
(Stored with Git LFS)
Normal file
BIN
SFX/581602__samsterbirdies__beep-error.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
19
SFX/581602__samsterbirdies__beep-error.mp3.import
Normal file
19
SFX/581602__samsterbirdies__beep-error.mp3.import
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://myr6n2c1u503"
|
||||
path="res://.godot/imported/581602__samsterbirdies__beep-error.mp3-f3f329247704643528e2ce4967834675.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://SFX/581602__samsterbirdies__beep-error.mp3"
|
||||
dest_files=["res://.godot/imported/581602__samsterbirdies__beep-error.mp3-f3f329247704643528e2ce4967834675.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
|
@ -1,13 +1,16 @@
|
|||
[gd_scene load_steps=28 format=3 uid="uid://c4pr2707hbeph"]
|
||||
[gd_scene load_steps=35 format=3 uid="uid://c4pr2707hbeph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="1_mpmil"]
|
||||
[ext_resource type="Script" uid="uid://chwqogny2v8t1" path="res://Scripts/Components/FSM/Player/Init.cs" id="2_i6wc8"]
|
||||
[ext_resource type="Script" uid="uid://bl0o35xt8wxtg" path="res://Scripts/Components/FSM/Player/Active.cs" id="3_3tuio"]
|
||||
[ext_resource type="Script" uid="uid://bo6xcjnw3yn6s" path="res://Scripts/Components/FSM/Player/Dead.cs" id="4_0pqs8"]
|
||||
[ext_resource type="Material" uid="uid://dnvwgyt2tbqmr" path="res://Resources/Materials/Player_Blink_Teleport_Material.tres" id="4_5qlss"]
|
||||
[ext_resource type="Script" uid="uid://dn2rrgw3e027b" path="res://Scripts/Components/FSM/Player/Cutscene.cs" id="4_22ff8"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://bc7mghjx75qip" path="res://Resources/Sprites/player.tres" id="4_s0ir4"]
|
||||
[ext_resource type="Script" uid="uid://b4nixnxhj5qhw" path="res://Scripts/Components/Actors/PlayerWeaponProvider.cs" id="5_gp3hw"]
|
||||
[ext_resource type="Script" uid="uid://b0khv2fcrgm6t" path="res://Scripts/Components/FSM/Player/Teleporting.cs" id="5_yifvs"]
|
||||
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="6_8dcio"]
|
||||
[ext_resource type="Script" uid="uid://bwtcgcvfw8urt" path="res://Scripts/Components/FSM/Player/Controlling.cs" id="6_82vrk"]
|
||||
[ext_resource type="Script" uid="uid://bo5sgbv1t8ril" path="res://Scripts/Components/Actors/PlayerAnimationProvider.cs" id="7_pmkfo"]
|
||||
[ext_resource type="Script" uid="uid://dq338w2lw5phl" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="8_i6wc8"]
|
||||
[ext_resource type="PackedScene" uid="uid://biugfbp0yae2s" path="res://Scenes/Particles/DeathParticles.tscn" id="9_0pyos"]
|
||||
|
|
@ -18,6 +21,9 @@
|
|||
[ext_resource type="Texture2D" uid="uid://bf37ce6jskdel" path="res://Sprites/SmallHitbox.png" id="13_pmkfo"]
|
||||
[ext_resource type="Script" uid="uid://dkmsw828qwikk" path="res://Scripts/Components/Actors/PlayerDamageReceiver.cs" id="14_igu66"]
|
||||
[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="15_5qlss"]
|
||||
[ext_resource type="Script" uid="uid://dv205x8msohpv" path="res://Scripts/Components/Actors/ActivationProvider.cs" id="22_12cwd"]
|
||||
[ext_resource type="PackedScene" uid="uid://chkpk7erlqajg" path="res://Scenes/Selector.tscn" id="23_5tmtw"]
|
||||
[ext_resource type="AudioStream" uid="uid://myr6n2c1u503" path="res://SFX/581602__samsterbirdies__beep-error.mp3" id="24_5tmtw"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_b3hxm"]
|
||||
|
||||
|
|
@ -78,6 +84,9 @@ animations = [{
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_igu66"]
|
||||
radius = 2.23607
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7n10g"]
|
||||
radius = 17.2627
|
||||
|
||||
[node name="FSMPlayer" type="CharacterBody2D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 97
|
||||
|
|
@ -88,7 +97,7 @@ InitialState = 1
|
|||
[node name="Init" type="Node2D" parent="."]
|
||||
script = ExtResource("2_i6wc8")
|
||||
|
||||
[node name="Active" type="Node2D" parent="." node_paths=PackedStringArray("_weaponProvider", "_animationProvider", "_crosshairProvider", "_hitboxSpriteProvider", "_inputProvider", "_damageReceiver")]
|
||||
[node name="Active" type="Node2D" parent="." node_paths=PackedStringArray("_weaponProvider", "_animationProvider", "_crosshairProvider", "_hitboxSpriteProvider", "_inputProvider", "_damageReceiver", "_activationProvider")]
|
||||
script = ExtResource("3_3tuio")
|
||||
_weaponProvider = NodePath("../WeaponProvider")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
|
|
@ -96,12 +105,28 @@ _crosshairProvider = NodePath("../CrosshairProvider")
|
|||
_hitboxSpriteProvider = NodePath("../StrafeSpriteProvider")
|
||||
_inputProvider = NodePath("../InputProvider")
|
||||
_damageReceiver = NodePath("../DamageReceiver")
|
||||
_activationProvider = NodePath("../InteractionProvider")
|
||||
State = 1
|
||||
|
||||
[node name="Cutscene" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("4_22ff8")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 2
|
||||
|
||||
[node name="Teleporting" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("5_yifvs")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 3
|
||||
|
||||
[node name="Controlling" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("6_82vrk")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 4
|
||||
|
||||
[node name="Dead" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("4_0pqs8")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 4
|
||||
State = 5
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_b3hxm")
|
||||
|
|
@ -174,4 +199,21 @@ 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 = 2
|
||||
collision_mask = 4
|
||||
script = ExtResource("22_12cwd")
|
||||
SelectorScene = ExtResource("23_5tmtw")
|
||||
_inputProvider = NodePath("../InputProvider")
|
||||
_errorSound = NodePath("Error")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionProvider"]
|
||||
shape = SubResource("CircleShape2D_7n10g")
|
||||
|
||||
[node name="Error" type="AudioStreamPlayer2D" parent="InteractionProvider"]
|
||||
stream = ExtResource("24_5tmtw")
|
||||
|
||||
[connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"]
|
||||
[connection signal="InteractableAreaEntered" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_entered"]
|
||||
[connection signal="InteractableAreaExited" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_exited"]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=19 format=4 uid="uid://dqyfnby0t7gu1"]
|
||||
[gd_scene load_steps=22 format=4 uid="uid://dqyfnby0t7gu1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_c3v4x"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_w1v1g"]
|
||||
|
|
@ -10,13 +10,16 @@
|
|||
[ext_resource type="Script" uid="uid://krean0uywtms" path="res://Scripts/TilemapAvoidance.cs" id="6_yyg8m"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="8_c3v4x"]
|
||||
[ext_resource type="Script" uid="uid://cfya7sndh7vy2" path="res://Scenes/CameraController.gd" id="9_dj0ui"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmr6fclttrpkb" path="res://Scenes/Items/Ammo1.tscn" id="10_6314l"]
|
||||
[ext_resource type="Script" uid="uid://c5nxsq3tyxcx6" path="res://Scripts/InventoryManager.cs" id="10_qmakk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dkwi1hu1bixoe" path="res://Scenes/HUD/HUD.tscn" id="11_hmqao"]
|
||||
[ext_resource type="Script" uid="uid://bdshph801ac2i" path="res://Scenes/CameraTarget.gd" id="12_8to53"]
|
||||
[ext_resource type="Script" uid="uid://cnkipcolyj61w" path="res://Scripts/AlarmManager.cs" id="13_8fnge"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0gpbkxdfbnjh" path="res://Scenes/Actors/ForceField_Horizontal.tscn" id="13_mljl7"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3tyacxxw88lx" path="res://Scenes/Utils/StreamPlayerWithName.tscn" id="14_q7rh4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd36ch65jijg0" path="res://Scenes/Activable/BulletEmitter.tscn" id="15_b3hxm"]
|
||||
[ext_resource type="Resource" uid="uid://bj331rcsq65es" path="res://Resources/Bullets/EmitterTestBullet.tres" id="16_u1i8n"]
|
||||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="20_0knpf"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6wo78"]
|
||||
script = ExtResource("4_u1i8n")
|
||||
|
|
@ -58,6 +61,17 @@ metadata/_edit_lock_ = true
|
|||
[node name="FSMPlayer" parent="Tilemaps/Actors" instance=ExtResource("8_c3v4x")]
|
||||
position = Vector2(76, 295)
|
||||
|
||||
[node name="Ammo1" parent="Tilemaps/Actors" instance=ExtResource("10_6314l")]
|
||||
position = Vector2(163, 302)
|
||||
|
||||
[node name="BulletEmitter" parent="Tilemaps/Actors" instance=ExtResource("15_b3hxm")]
|
||||
position = Vector2(59.7855, 263.59)
|
||||
BulletResource = ExtResource("16_u1i8n")
|
||||
EmitOnStart = true
|
||||
|
||||
[node name="HorizontalForceField" parent="Tilemaps/Actors" instance=ExtResource("13_mljl7")]
|
||||
position = Vector2(304, 303)
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
process_mode = 1
|
||||
script = ExtResource("9_dj0ui")
|
||||
|
|
@ -76,11 +90,11 @@ script = ExtResource("10_qmakk")
|
|||
[node name="HUD" parent="." instance=ExtResource("11_hmqao")]
|
||||
|
||||
[node name="CameraTarget" type="Node2D" parent="."]
|
||||
position = Vector2(115, 328)
|
||||
position = Vector2(124, 338)
|
||||
script = ExtResource("12_8to53")
|
||||
|
||||
[node name="PlayerStartPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(111, 305)
|
||||
position = Vector2(155, 370)
|
||||
|
||||
[node name="AlarmManager" type="Node2D" parent="."]
|
||||
process_mode = 1
|
||||
|
|
@ -90,7 +104,6 @@ script = ExtResource("13_8fnge")
|
|||
process_mode = 3
|
||||
autoplay = true
|
||||
|
||||
[node name="BulletEmitter" parent="." instance=ExtResource("15_b3hxm")]
|
||||
position = Vector2(59.7855, 263.59)
|
||||
BulletResource = ExtResource("16_u1i8n")
|
||||
EmitOnStart = true
|
||||
[node name="ControlPad" parent="." node_paths=PackedStringArray("Targets") instance=ExtResource("20_0knpf")]
|
||||
position = Vector2(279, 306)
|
||||
Targets = [NodePath("../Tilemaps/Actors/HorizontalForceField")]
|
||||
|
|
|
|||
|
|
@ -33,3 +33,5 @@ script = ExtResource("1_pp2dj")
|
|||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
z_index = -5
|
||||
sprite_frames = SubResource("SpriteFrames_kehny")
|
||||
autoplay = "default"
|
||||
frame_progress = 0.00057048
|
||||
|
|
|
|||
106
Scripts/Components/Actors/ActivationProvider.cs
Normal file
106
Scripts/Components/Actors/ActivationProvider.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
||||
public partial class ActivationProvider : Area2D
|
||||
{
|
||||
public bool Enabled { get; set; } = false;
|
||||
|
||||
private Selector _selector;
|
||||
|
||||
[Export]
|
||||
public PackedScene SelectorScene { get; set; }
|
||||
|
||||
[Export]
|
||||
private InputProvider _inputProvider;
|
||||
|
||||
[Export] private AudioStreamPlayer2D _errorSound;
|
||||
|
||||
[Signal]
|
||||
public delegate void InteractableAreaEnteredEventHandler(Interactable interactable);
|
||||
|
||||
[Signal]
|
||||
public delegate void InteractableAreaExitedEventHandler(Interactable interactable);
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (SelectorScene is not null && _selector is null)
|
||||
{
|
||||
_selector = this.CreateSibling<Selector>(SelectorScene, this.GlobalPosition);
|
||||
_selector.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleInteraction()
|
||||
{
|
||||
if (_inputProvider.GetUseJustPressed())
|
||||
{
|
||||
TrySelect();
|
||||
}
|
||||
|
||||
if (_inputProvider.GetScanJustPressed())
|
||||
{
|
||||
_selector.SelectNext();
|
||||
}
|
||||
}
|
||||
|
||||
private void TrySelect()
|
||||
{
|
||||
var selected = _selector.SelectedInteractable;
|
||||
if (selected is null)
|
||||
{
|
||||
_errorSound?.Play();
|
||||
return;
|
||||
};
|
||||
if (!selected.CanActivate())
|
||||
{
|
||||
_errorSound?.Play();
|
||||
return;
|
||||
};
|
||||
bool success = selected.Activate();
|
||||
|
||||
if (success)
|
||||
{
|
||||
// Deselect and scan for next
|
||||
_selector.RemoveInteractable(selected);
|
||||
//_selector.SelectedInteractable = null;
|
||||
//_selector.SelectNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorSound?.Play();
|
||||
}
|
||||
|
||||
//var spaceState = GetWorld2D().DirectSpaceState;
|
||||
|
||||
//var query = PhysicsRayQueryParameters2D.Create(Vector2.Zero, )
|
||||
}
|
||||
|
||||
private void _on_interaction_controller_area_entered(Area2D area)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
if (area.IsInGroup("Interactable") && area is Interactable interactable && interactable.CanActivate())
|
||||
{
|
||||
EmitSignal(nameof(InteractableAreaEntered), interactable);
|
||||
|
||||
if (_selector == null) return;
|
||||
|
||||
_selector.AddInteractable(interactable);
|
||||
|
||||
//_selector.SelectedInteractable = interactable;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void _on_interaction_controller_area_exited(Area2D area)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
if (area.IsInGroup("Interactable") && area is Interactable interactable)
|
||||
{
|
||||
EmitSignal(nameof(InteractableAreaExited), interactable);
|
||||
|
||||
if (_selector == null) return;
|
||||
_selector.RemoveInteractable(interactable);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/Actors/ActivationProvider.cs.uid
Normal file
1
Scripts/Components/Actors/ActivationProvider.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dv205x8msohpv
|
||||
|
|
@ -12,6 +12,7 @@ public abstract partial class InputProvider : Node2D
|
|||
|
||||
public abstract bool GetShootPressed();
|
||||
public abstract bool GetUseJustPressed();
|
||||
public abstract bool GetScanJustPressed();
|
||||
public abstract bool GetStrafePressed();
|
||||
public abstract bool GetWeaponNextJustPressed();
|
||||
public abstract bool GetWeaponPreviousJustPressed();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public partial class KeyboardInputProvider : InputProvider
|
|||
[ExportCategory("Action Names")]
|
||||
[Export] private string _shootActionName = "shoot";
|
||||
[Export] private string _useActionName = "Use";
|
||||
[Export] private string _scanActionName = "scan";
|
||||
[Export] private string _strafeActionName = "strafe";
|
||||
[Export] private string _nextWeaponActionName = "next_weapon";
|
||||
[Export] private string _previousWeaponActionName = "previous_weapon";
|
||||
|
|
@ -68,6 +69,10 @@ public partial class KeyboardInputProvider : InputProvider
|
|||
{
|
||||
return GetActionJustPressed(_useActionName);
|
||||
}
|
||||
public override bool GetScanJustPressed()
|
||||
{
|
||||
return GetActionJustPressed(_scanActionName);
|
||||
}
|
||||
|
||||
public override bool GetStrafePressed()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public partial class Active : PlayerFSMState
|
|||
private InputProvider _inputProvider;
|
||||
|
||||
[Export] private PlayerDamageReceiver _damageReceiver;
|
||||
[Export] private ActivationProvider _activationProvider;
|
||||
|
||||
private bool _isStrafing;
|
||||
|
||||
|
|
@ -58,6 +59,8 @@ public partial class Active : PlayerFSMState
|
|||
|
||||
_damageReceiver.Init();
|
||||
|
||||
_activationProvider.Init();
|
||||
|
||||
//_weaponProvider = stateMachine.GetNode<PlayerWeaponProvider>("WeaponProvider");
|
||||
//_animationProvider = stateMachine.GetNode<PlayerAnimationProvider>("AnimationProvider");
|
||||
|
||||
|
|
@ -71,6 +74,7 @@ public partial class Active : PlayerFSMState
|
|||
_crosshairProvider.Show();
|
||||
|
||||
_damageReceiver.Enabled = true;
|
||||
_activationProvider.Enabled = true;
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
|
|
@ -80,6 +84,7 @@ public partial class Active : PlayerFSMState
|
|||
_hitboxSpriteProvider.Hide();
|
||||
|
||||
_damageReceiver.Enabled = false;
|
||||
_activationProvider.Enabled = false;
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
|
|
@ -117,6 +122,8 @@ public partial class Active : PlayerFSMState
|
|||
_crosshairProvider.UpdatePosition(FacingDirection);
|
||||
|
||||
HandleShoot();
|
||||
|
||||
HandleInteraction();
|
||||
// FindInteractable();
|
||||
|
||||
// _crosshair.Position = CalculateCrosshairPosition();
|
||||
|
|
@ -129,5 +136,8 @@ public partial class Active : PlayerFSMState
|
|||
_weaponProvider.Shoot(this.FacingDirection);
|
||||
}
|
||||
|
||||
|
||||
private void HandleInteraction()
|
||||
{
|
||||
_activationProvider.HandleInteraction();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
29
Scripts/Components/FSM/Player/Controlling.cs
Normal file
29
Scripts/Components/FSM/Player/Controlling.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class Controlling : PlayerFSMState
|
||||
{
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/Controlling.cs.uid
Normal file
1
Scripts/Components/FSM/Player/Controlling.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bwtcgcvfw8urt
|
||||
29
Scripts/Components/FSM/Player/Cutscene.cs
Normal file
29
Scripts/Components/FSM/Player/Cutscene.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class Cutscene : PlayerFSMState
|
||||
{
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/Cutscene.cs.uid
Normal file
1
Scripts/Components/FSM/Player/Cutscene.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dn2rrgw3e027b
|
||||
|
|
@ -6,19 +6,28 @@ public partial class Dead : PlayerFSMState
|
|||
{
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void Init(ActorStateMachine stateMachine)
|
||||
{
|
||||
base.Init(stateMachine);
|
||||
// get hud?
|
||||
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider.PlayDeathAnimation();
|
||||
// show game over
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
// Hide game over
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
// wait for button
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
29
Scripts/Components/FSM/Player/Teleporting.cs
Normal file
29
Scripts/Components/FSM/Player/Teleporting.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class Teleporting : PlayerFSMState
|
||||
{
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/Teleporting.cs.uid
Normal file
1
Scripts/Components/FSM/Player/Teleporting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b0khv2fcrgm6t
|
||||
|
|
@ -584,6 +584,7 @@ public enum PlayerState
|
|||
Init,
|
||||
Active,
|
||||
Cutscene,
|
||||
Teleporting,
|
||||
Controlling,
|
||||
Dead,
|
||||
}
|
||||
|
|
@ -42,22 +42,22 @@ public partial class Selector : Node2D
|
|||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("scan"))
|
||||
{
|
||||
SelectNext();
|
||||
}
|
||||
|
||||
// if (SelectedInteractable is not null) {
|
||||
// this.Visible = true;
|
||||
// this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Visible = false;
|
||||
// }
|
||||
}
|
||||
// public override void _Process(double delta)
|
||||
// {
|
||||
// if (Input.IsActionJustPressed("scan"))
|
||||
// {
|
||||
// SelectNext();
|
||||
// }
|
||||
//
|
||||
// // if (SelectedInteractable is not null) {
|
||||
// // this.Visible = true;
|
||||
// // this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // this.Visible = false;
|
||||
// // }
|
||||
// }
|
||||
|
||||
public void SelectNext()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue