mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 13:13:48 +00:00
Fixed teleporters
This commit is contained in:
parent
9c3f22760b
commit
49cfb52d20
15 changed files with 102 additions and 84 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Godot.NET.Sdk/4.4.0">
|
<Project Sdk="Godot.NET.Sdk/4.4.0-rc.1">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Godot.NET.Sdk/4.4.0-rc.3">
|
<Project Sdk="Godot.NET.Sdk/4.4.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[gd_scene load_steps=41 format=3 uid="uid://c4pr2707hbeph"]
|
[gd_scene load_steps=42 format=3 uid="uid://c4pr2707hbeph"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://d2ubk5gucny6s" path="res://Scripts/Components/FSM/PlayerFSMProxy.cs" id="1_g3wua"]
|
||||||
[ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="1_mpmil"]
|
[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://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://bl0o35xt8wxtg" path="res://Scripts/Components/FSM/Player/Active.cs" id="3_3tuio"]
|
||||||
|
|
@ -109,56 +110,56 @@ radius = 17.2627
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_g3wua"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_g3wua"]
|
||||||
radius = 9.0
|
radius = 9.0
|
||||||
|
|
||||||
[node name="FSMPlayer" type="CharacterBody2D"]
|
[node name="FSMPlayer" type="CharacterBody2D" node_paths=PackedStringArray("PlayerFSM", "InteractionController")]
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 97
|
collision_mask = 97
|
||||||
platform_wall_layers = 97
|
platform_wall_layers = 97
|
||||||
script = ExtResource("1_mpmil")
|
script = ExtResource("1_g3wua")
|
||||||
|
PlayerFSM = NodePath("StateMachine")
|
||||||
|
InteractionController = NodePath("InteractionController")
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="Init" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
[node name="StateMachine" type="Node2D" parent="."]
|
||||||
|
script = ExtResource("1_mpmil")
|
||||||
|
|
||||||
|
[node name="Init" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||||
script = ExtResource("2_i6wc8")
|
script = ExtResource("2_i6wc8")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
|
|
||||||
[node name="Active" type="Node2D" parent="." node_paths=PackedStringArray("_weaponProvider", "_animationProvider", "_crosshairProvider", "_hitboxSpriteProvider", "_inputProvider", "_damageReceiver", "_activationProvider", "_interactionController")]
|
[node name="Active" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_weaponProvider", "_animationProvider", "_crosshairProvider", "_hitboxSpriteProvider", "_inputProvider", "_damageReceiver", "_activationProvider", "_interactionController", "_moduleNodes")]
|
||||||
script = ExtResource("3_3tuio")
|
script = ExtResource("3_3tuio")
|
||||||
_weaponProvider = NodePath("../WeaponProvider")
|
_weaponProvider = NodePath("../../WeaponProvider")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
_crosshairProvider = NodePath("../CrosshairProvider")
|
_crosshairProvider = NodePath("../../CrosshairProvider")
|
||||||
_hitboxSpriteProvider = NodePath("../StrafeSpriteProvider")
|
_hitboxSpriteProvider = NodePath("../../StrafeSpriteProvider")
|
||||||
_inputProvider = NodePath("../InputProvider")
|
_inputProvider = NodePath("../../InputProvider")
|
||||||
_damageReceiver = NodePath("../DamageReceiver")
|
_damageReceiver = NodePath("../../DamageReceiver")
|
||||||
_activationProvider = NodePath("../InteractionProvider")
|
_activationProvider = NodePath("../../InteractionProvider")
|
||||||
_interactionController = NodePath("../InteractionController")
|
_interactionController = NodePath("../../InteractionController")
|
||||||
State = 1
|
_moduleNodes = [NodePath("../../InteractionController")]
|
||||||
|
|
||||||
[node name="Cutscene" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
[node name="Cutscene" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||||
script = ExtResource("4_22ff8")
|
script = ExtResource("4_22ff8")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
State = 2
|
|
||||||
|
|
||||||
[node name="Teleporting" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
[node name="Teleporting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||||
script = ExtResource("5_yifvs")
|
script = ExtResource("5_yifvs")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
State = 3
|
|
||||||
|
|
||||||
[node name="UnTeleporting" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
[node name="UnTeleporting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||||
script = ExtResource("6_7n10g")
|
script = ExtResource("6_7n10g")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
State = 4
|
|
||||||
|
|
||||||
[node name="Controlling" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
[node name="Controlling" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||||
script = ExtResource("6_82vrk")
|
script = ExtResource("6_82vrk")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
State = 5
|
|
||||||
|
|
||||||
[node name="Dead" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider")]
|
[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider")]
|
||||||
script = ExtResource("4_0pqs8")
|
script = ExtResource("4_0pqs8")
|
||||||
_animationProvider = NodePath("../AnimationProvider")
|
_animationProvider = NodePath("../../AnimationProvider")
|
||||||
_inputProvider = NodePath("../InputProvider")
|
_inputProvider = NodePath("../../InputProvider")
|
||||||
_healthProvider = NodePath("../DamageReceiver/HealthProvider")
|
_healthProvider = NodePath("../../DamageReceiver/HealthProvider")
|
||||||
State = 6
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_b3hxm")
|
shape = SubResource("CircleShape2D_b3hxm")
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,4 @@ process_mode = 3
|
||||||
stream = ExtResource("4_ildd2")
|
stream = ExtResource("4_ildd2")
|
||||||
max_distance = 100.0
|
max_distance = 100.0
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ public partial class InteractionController : PlayerArea2DModule
|
||||||
{
|
{
|
||||||
[Export] public ActorResourceProvider Health { get; private set; }
|
[Export] public ActorResourceProvider Health { get; private set; }
|
||||||
[Export] public ActorResourceProvider Shield { get; private set; }
|
[Export] public ActorResourceProvider Shield { get; private set; }
|
||||||
|
|
||||||
private bool _enabled = false;
|
private bool _enabled = false;
|
||||||
|
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
|
|
@ -23,7 +23,7 @@ public partial class InteractionController : PlayerArea2DModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void InteractionStartedEventHandler();
|
public delegate void InteractionStartedEventHandler();
|
||||||
|
|
||||||
|
|
@ -39,16 +39,16 @@ public partial class InteractionController : PlayerArea2DModule
|
||||||
|
|
||||||
public override void Init(IStateMachine<PlayerState, CharacterBody2D> machine)
|
public override void Init(IStateMachine<PlayerState, CharacterBody2D> machine)
|
||||||
{
|
{
|
||||||
|
base.Init(machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Process(double delta)
|
public override void Process(double delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PhysicsProcess(double delta)
|
public override void PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://cvctgw8eo2f7e"]
|
[gd_scene load_steps=8 format=3 uid="uid://cvctgw8eo2f7e"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_bdsed"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_bdsed"]
|
||||||
[ext_resource type="Resource" uid="uid://dhbltvgsa3g88" path="res://Resources/Items/Spider_Bomb_Pickup.tres" id="2_bdsed"]
|
[ext_resource type="Resource" uid="uid://dhbltvgsa3g88" path="res://Resources/Items/Spider_Bomb_Pickup.tres" id="2_bdsed"]
|
||||||
|
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_fyf8h"]
|
||||||
[ext_resource type="Texture2D" uid="uid://huo14jdekj6n" path="res://Sprites/Bullets/spiderbomb.png" id="3_bdsed"]
|
[ext_resource type="Texture2D" uid="uid://huo14jdekj6n" path="res://Sprites/Bullets/spiderbomb.png" id="3_bdsed"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||||
|
|
@ -25,7 +26,7 @@ animations = [{
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_bdsed")
|
script = ExtResource("1_bdsed")
|
||||||
LootTable = [ExtResource("2_bdsed")]
|
LootTable = Array[ExtResource("2_fyf8h")]([ExtResource("2_bdsed")])
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ PlayerTemplate = ExtResource("8_c3v4x")
|
||||||
SpawnMarkers = Dictionary[int, NodePath]({
|
SpawnMarkers = Dictionary[int, NodePath]({
|
||||||
0: NodePath("PlayerStartPosition")
|
0: NodePath("PlayerStartPosition")
|
||||||
})
|
})
|
||||||
StartingEquipment = Array[ExtResource("5_u1i8n")]([ExtResource("3_6314l"), ExtResource("4_yyg8m")])
|
StartingEquipment = [ExtResource("3_6314l"), ExtResource("4_yyg8m")]
|
||||||
MapStartData = SubResource("Resource_6wo78")
|
MapStartData = SubResource("Resource_6wo78")
|
||||||
|
|
||||||
[node name="Tilemaps" type="Node2D" parent="."]
|
[node name="Tilemaps" type="Node2D" parent="."]
|
||||||
|
|
@ -189,7 +189,7 @@ position = Vector2(124, 338)
|
||||||
script = ExtResource("12_8to53")
|
script = ExtResource("12_8to53")
|
||||||
|
|
||||||
[node name="PlayerStartPosition" type="Marker2D" parent="."]
|
[node name="PlayerStartPosition" type="Marker2D" parent="."]
|
||||||
position = Vector2(371, 180)
|
position = Vector2(149, 367)
|
||||||
|
|
||||||
[node name="AlarmManager" type="Node2D" parent="."]
|
[node name="AlarmManager" type="Node2D" parent="."]
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ SpawnMarkers = Dictionary[int, NodePath]({
|
||||||
2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
||||||
255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
255: NodePath("Factory Tilemaps/Debug Room/DebugRoomStartPosition")
|
||||||
})
|
})
|
||||||
StartingEquipment = [ExtResource("4_swym2"), ExtResource("5_nqier")]
|
StartingEquipment = Array[ExtResource("6_8tdlb")]([ExtResource("4_swym2"), ExtResource("5_nqier")])
|
||||||
MapStartData = SubResource("Resource_6sau4")
|
MapStartData = SubResource("Resource_6sau4")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
|
@ -984,7 +984,7 @@ position = Vector2(-2000, -736)
|
||||||
[node name="ControlPad8" parent="Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
[node name="ControlPad8" parent="Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
||||||
position = Vector2(-2027, -735)
|
position = Vector2(-2027, -735)
|
||||||
Targets = [NodePath("../HorizontalForceField")]
|
Targets = [NodePath("../HorizontalForceField")]
|
||||||
Requirements = [ExtResource("84_ma1ta")]
|
Requirements = Array[ExtResource("6_8tdlb")]([ExtResource("84_ma1ta")])
|
||||||
|
|
||||||
[node name="IcicleRepeater2" parent="Factory Tilemaps/LevelProps" instance=ExtResource("32_xof4a")]
|
[node name="IcicleRepeater2" parent="Factory Tilemaps/LevelProps" instance=ExtResource("32_xof4a")]
|
||||||
position = Vector2(-923, 69)
|
position = Vector2(-923, 69)
|
||||||
|
|
|
||||||
|
|
@ -15,41 +15,41 @@ public partial class Teleporter : Activable
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public bool Invisible { get; private set; } = false;
|
public bool Invisible { get; private set; } = false;
|
||||||
|
|
||||||
public bool IsPrimed { get; private set; }
|
public bool IsPrimed { get; private set; }
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public Teleporter Target { get; set; }
|
public Teleporter Target { get; set; }
|
||||||
|
|
||||||
[Export] public float ParticleEmitTime { get; private set; } = 2f;
|
[Export] public float ParticleEmitTime { get; private set; } = 2f;
|
||||||
|
|
||||||
[Export] public float TeleportAnimationLength { get; private set; } = 0.5f;
|
[Export] public float TeleportAnimationLength { get; private set; } = 0.5f;
|
||||||
|
|
||||||
[Export] public Vector2 TeleportOffset { get; private set; } = new Vector2(0,-4f);
|
[Export] public Vector2 TeleportOffset { get; private set; } = new Vector2(0, -4f);
|
||||||
|
|
||||||
private double _particleTimer;
|
private double _particleTimer;
|
||||||
|
|
||||||
private AnimatedSprite2D _animatedSprite;
|
private AnimatedSprite2D _animatedSprite;
|
||||||
|
|
||||||
// [Export]
|
// [Export]
|
||||||
// public GpuParticles2D Particles { get; set; }
|
// public GpuParticles2D Particles { get; set; }
|
||||||
|
|
||||||
protected GpuParticles2D _particles;
|
protected GpuParticles2D _particles;
|
||||||
|
|
||||||
private AudioStreamPlayer2D _teleportStartSound;
|
private AudioStreamPlayer2D _teleportStartSound;
|
||||||
private AudioStreamPlayer2D _teleportEndSound;
|
private AudioStreamPlayer2D _teleportEndSound;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_particles = GetNode<GpuParticles2D>("./Particles");
|
_particles = GetNode<GpuParticles2D>("./Particles");
|
||||||
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||||
|
|
||||||
IsPrimed = true;
|
IsPrimed = true;
|
||||||
_particles.Emitting = false;
|
_particles.Emitting = false;
|
||||||
_particleTimer = 0;
|
_particleTimer = 0;
|
||||||
|
|
||||||
this.Visible = !Invisible;
|
this.Visible = !Invisible;
|
||||||
|
|
||||||
if (IsEnabled)
|
if (IsEnabled)
|
||||||
{
|
{
|
||||||
_animatedSprite.Play("Active");
|
_animatedSprite.Play("Active");
|
||||||
|
|
@ -66,7 +66,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if (!_particles.Emitting) return;
|
if (!_particles.Emitting) return;
|
||||||
|
|
||||||
_particleTimer += delta;
|
_particleTimer += delta;
|
||||||
|
|
||||||
if (_particleTimer >= ParticleEmitTime)
|
if (_particleTimer >= ParticleEmitTime)
|
||||||
|
|
@ -75,7 +75,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
_particles.Emitting = false;
|
_particles.Emitting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
public override void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||||
{
|
{
|
||||||
switch (activationType)
|
switch (activationType)
|
||||||
|
|
@ -113,11 +113,13 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
_particles.Emitting = true;
|
_particles.Emitting = true;
|
||||||
_particleTimer = 0;
|
_particleTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _on_area_entered(Area2D area)
|
private void _on_area_entered(Area2D area)
|
||||||
{
|
{
|
||||||
|
GD.Print("Something entered the teleporter");
|
||||||
if (!IsEnabled) return;
|
if (!IsEnabled) return;
|
||||||
if (area is not InteractionController interactionController) return;
|
if (area is not InteractionController interactionController) return;
|
||||||
|
GD.Print("Player entered the teleporter");
|
||||||
|
|
||||||
if (!IsPrimed)
|
if (!IsPrimed)
|
||||||
{
|
{
|
||||||
|
|
@ -125,11 +127,12 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
//_particles.Emitting = false;
|
//_particles.Emitting = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teleport player to target if active
|
// Teleport player to target if active
|
||||||
if (!IsEnabled) return;
|
if (!IsEnabled) return;
|
||||||
|
|
||||||
|
GD.Print("Teleporting...");
|
||||||
|
|
||||||
// Call Teleport here
|
// Call Teleport here
|
||||||
_ = Teleport(interactionController.StateMachine);
|
_ = Teleport(interactionController.StateMachine);
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +144,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
player.SetState(PlayerState.Cutscene);
|
player.SetState(PlayerState.Cutscene);
|
||||||
|
|
||||||
await TweenPlayer(player.MainObject);
|
await TweenPlayer(player.MainObject);
|
||||||
|
|
||||||
PlayTeleportStartSound();
|
PlayTeleportStartSound();
|
||||||
|
|
||||||
//_particles.Emitting = true;
|
//_particles.Emitting = true;
|
||||||
|
|
@ -150,17 +153,17 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
//await player.Teleport();
|
//await player.Teleport();
|
||||||
player.SetState(PlayerState.Teleporting);
|
player.SetState(PlayerState.Teleporting);
|
||||||
await Task.Delay((int)(0.6f * 1000));
|
await Task.Delay((int)(0.6f * 1000));
|
||||||
|
|
||||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||||
|
|
||||||
Target.PrepareForReceiving();
|
Target.PrepareForReceiving();
|
||||||
player.MainObject.GlobalPosition = Target.GlobalPosition + TeleportOffset;
|
player.MainObject.GlobalPosition = Target.GlobalPosition + TeleportOffset;
|
||||||
Target.PlayTeleportEndSound();
|
Target.PlayTeleportEndSound();
|
||||||
//await player.UnTeleport();
|
//await player.UnTeleport();
|
||||||
|
|
||||||
player.SetState(PlayerState.UnTeleporting);
|
player.SetState(PlayerState.UnTeleporting);
|
||||||
await Task.Delay((int)(0.6f * 1000));
|
await Task.Delay((int)(0.6f * 1000));
|
||||||
|
|
||||||
//player.RequestMovementDisable(false);
|
//player.RequestMovementDisable(false);
|
||||||
player.SetState(PlayerState.Active);
|
player.SetState(PlayerState.Active);
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +181,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
||||||
protected async Task TweenPlayer(CharacterBody2D player)
|
protected async Task TweenPlayer(CharacterBody2D player)
|
||||||
{
|
{
|
||||||
await player.TweenGlobalPosition(GlobalPosition + new Vector2(0, -4f), TeleportAnimationLength).PlayAsync(CancellationToken.None);
|
await player.TweenGlobalPosition(GlobalPosition + new Vector2(0, -4f), TeleportAnimationLength).PlayAsync(CancellationToken.None);
|
||||||
|
|
||||||
// Create a Tween for the teleport animation
|
// Create a Tween for the teleport animation
|
||||||
// Tween tween = GetTree().CreateTween();
|
// Tween tween = GetTree().CreateTween();
|
||||||
// tween.SetEase(Tween.EaseType.InOut);
|
// tween.SetEase(Tween.EaseType.InOut);
|
||||||
|
|
|
||||||
1
Scripts/Components/FSM/Player/PlayerStateBase.cs.uid
Normal file
1
Scripts/Components/FSM/Player/PlayerStateBase.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://s5ok5qd2symf
|
||||||
|
|
@ -4,11 +4,11 @@ namespace Cirno.Scripts.Components.FSM.Player;
|
||||||
|
|
||||||
public partial class Teleporting : PlayerStateBase
|
public partial class Teleporting : PlayerStateBase
|
||||||
{
|
{
|
||||||
public override PlayerState StateId => PlayerState.Init;
|
public override PlayerState StateId => PlayerState.Teleporting;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private PlayerAnimationProvider _animationProvider;
|
private PlayerAnimationProvider _animationProvider;
|
||||||
|
|
||||||
public override void EnterState()
|
public override void EnterState()
|
||||||
{
|
{
|
||||||
_animationProvider.PlayTeleportAnimation();
|
_animationProvider.PlayTeleportAnimation();
|
||||||
|
|
@ -16,16 +16,16 @@ public partial class Teleporting : PlayerStateBase
|
||||||
|
|
||||||
public override void ExitState()
|
public override void ExitState()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessState(double delta)
|
public override void ProcessState(double delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PhysicsProcessState(double delta)
|
public override void PhysicsProcessState(double delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1
Scripts/Components/FSM/PlayerArea2DModule.cs.uid
Normal file
1
Scripts/Components/FSM/PlayerArea2DModule.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bnerroq14m4ds
|
||||||
10
Scripts/Components/FSM/PlayerFSMProxy.cs
Normal file
10
Scripts/Components/FSM/PlayerFSMProxy.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Cirno.Scripts.Components.FSM;
|
||||||
|
|
||||||
|
public partial class PlayerFSMProxy : CharacterBody2D
|
||||||
|
{
|
||||||
|
[Export] public PlayerStateMachine PlayerFSM { get; private set; }
|
||||||
|
[Export] public InteractionController InteractionController { get; private set; }
|
||||||
|
}
|
||||||
1
Scripts/Components/FSM/PlayerFSMProxy.cs.uid
Normal file
1
Scripts/Components/FSM/PlayerFSMProxy.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d2ubk5gucny6s
|
||||||
|
|
@ -13,11 +13,11 @@ public partial class GameManager : Node2D
|
||||||
public static GameManager Instance { get; private set; }
|
public static GameManager Instance { get; private set; }
|
||||||
private Hud _hud;
|
private Hud _hud;
|
||||||
|
|
||||||
private PlayerStateMachine _player;
|
private PlayerFSMProxy _player;
|
||||||
|
|
||||||
public GameState GameState { get; private set; }
|
public GameState GameState { get; private set; }
|
||||||
|
|
||||||
public PlayerStateMachine Player => _player;
|
public PlayerStateMachine Player => _player.PlayerFSM;
|
||||||
|
|
||||||
private Node2D _cameraTarget;
|
private Node2D _cameraTarget;
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ public partial class GameManager : Node2D
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void PlayerRespawnedEventHandler();
|
public delegate void PlayerRespawnedEventHandler();
|
||||||
|
|
||||||
public Vector2 LastCheckpointPosition { get; set; }
|
public Vector2 LastCheckpointPosition { get; set; }
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
|
|
@ -110,7 +110,7 @@ public partial class GameManager : Node2D
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if (GameState is GameState.Paused && Input.IsActionJustPressed(PauseActionName))
|
if (GameState is GameState.Paused && Input.IsActionJustPressed(PauseActionName))
|
||||||
|
|
@ -160,7 +160,7 @@ public partial class GameManager : Node2D
|
||||||
if (_player != null) return;
|
if (_player != null) return;
|
||||||
|
|
||||||
//_player = this.CreateChild<PlayerMovement>(PlayerTemplate, PlayerSpawnMarker.Position );
|
//_player = this.CreateChild<PlayerMovement>(PlayerTemplate, PlayerSpawnMarker.Position );
|
||||||
_player = PlayerTemplate.Instantiate<PlayerStateMachine>();
|
_player = PlayerTemplate.Instantiate<PlayerFSMProxy>();
|
||||||
|
|
||||||
this.CallDeferred("add_child", _player);
|
this.CallDeferred("add_child", _player);
|
||||||
_player.Transform = this.GlobalTransform;
|
_player.Transform = this.GlobalTransform;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue