mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 00:45:54 +00:00
Teleporters
This commit is contained in:
parent
7e76edc153
commit
1907a38575
25 changed files with 616 additions and 4 deletions
1
3D/BlockbenchModels/Barrel/Barrel.bbmodel
Normal file
1
3D/BlockbenchModels/Barrel/Barrel.bbmodel
Normal file
File diff suppressed because one or more lines are too long
1
3D/BlockbenchModels/Barrel/Barrel.gltf
Normal file
1
3D/BlockbenchModels/Barrel/Barrel.gltf
Normal file
File diff suppressed because one or more lines are too long
37
3D/BlockbenchModels/Barrel/Barrel.gltf.import
Normal file
37
3D/BlockbenchModels/Barrel/Barrel.gltf.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://c6k5ii0onbh3j"
|
||||
path="res://.godot/imported/Barrel.gltf-033e7b9c1e31cb6511d8d8b9c8f09592.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://3D/BlockbenchModels/Barrel/Barrel.gltf"
|
||||
dest_files=["res://.godot/imported/Barrel.gltf-033e7b9c1e31cb6511d8d8b9c8f09592.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
BIN
3D/BlockbenchModels/Barrel/Barrel_0.png
(Stored with Git LFS)
Normal file
BIN
3D/BlockbenchModels/Barrel/Barrel_0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
37
3D/BlockbenchModels/Barrel/Barrel_0.png.import
Normal file
37
3D/BlockbenchModels/Barrel/Barrel_0.png.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ce12nbymqk7eu"
|
||||
path="res://.godot/imported/Barrel_0.png-ea40281661ff45b381d803800b1f2f37.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "2534c8a8e4bbb92d500633735de1d414"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://3D/BlockbenchModels/Barrel/Barrel_0.png"
|
||||
dest_files=["res://.godot/imported/Barrel_0.png-ea40281661ff45b381d803800b1f2f37.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
3D/BlockbenchModels/Barrel/Barrel_1.png
(Stored with Git LFS)
Normal file
BIN
3D/BlockbenchModels/Barrel/Barrel_1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
37
3D/BlockbenchModels/Barrel/Barrel_1.png.import
Normal file
37
3D/BlockbenchModels/Barrel/Barrel_1.png.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cd832q85enry5"
|
||||
path="res://.godot/imported/Barrel_1.png-384929c143219694d75a2af907eabeac.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "02149eab1cadac3a944d26e9f49ac1ad"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://3D/BlockbenchModels/Barrel/Barrel_1.png"
|
||||
dest_files=["res://.godot/imported/Barrel_1.png-384929c143219694d75a2af907eabeac.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=408 format=4 uid="uid://c8gtrjf2xeue7"]
|
||||
[gd_scene load_steps=409 format=4 uid="uid://c8gtrjf2xeue7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://kno58homctew" path="res://addons/func_godot/src/map/func_godot_map.gd" id="1_n6h0p"]
|
||||
[ext_resource type="Script" uid="uid://crpgy1o73rtlx" path="res://Scripts/Utils/MapProxy3D.cs" id="1_pvlbf"]
|
||||
|
|
@ -90,6 +90,7 @@
|
|||
[ext_resource type="Resource" uid="uid://bdpbekqhuuq4l" path="res://Resources/Items/Shield_Extend_Pickup.tres" id="77_mf5at"]
|
||||
[ext_resource type="Script" uid="uid://b5fesrd4lv8t1" path="res://Scripts/Resources/Events/EventResource.cs" id="82_rri8m"]
|
||||
[ext_resource type="PackedScene" uid="uid://dioiq4nb7kiet" path="res://3D/Scenes/Props/ForceField_3D.tscn" id="83_51d8c"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbv1l74q66rdr" path="res://3D/Scenes/Props/Teleporter_3D.tscn" id="83_rri8m"]
|
||||
[ext_resource type="Resource" uid="uid://c48vva6qw2h12" path="res://Resources/Enemies/Base_Fairy_Special_3D.tres" id="88_6uhge"]
|
||||
[ext_resource type="Resource" uid="uid://dau0s8ob7qnpc" path="res://Resources/Items/IceShotgun.tres" id="88_kob5s"]
|
||||
[ext_resource type="Resource" uid="uid://bgcgeg187vg1h" path="res://Resources/Items/IcicleRepeater.tres" id="89_awrmj"]
|
||||
|
|
@ -3377,6 +3378,16 @@ shape = SubResource("SphereShape3D_rfncj")
|
|||
transform = Transform3D(1.31134e-07, 0, -1, 0, 1, 0, 1, 0, 1.31134e-07, 7.56185, 2.23262, 23.3804)
|
||||
Target = NodePath("../Door")
|
||||
|
||||
[node name="Teleporter" parent="Props" node_paths=PackedStringArray("Target") instance=ExtResource("83_rri8m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26.1629, 1, 8.69657)
|
||||
IsEnabled = true
|
||||
Target = NodePath("../Teleporter2")
|
||||
|
||||
[node name="Teleporter2" parent="Props" node_paths=PackedStringArray("Target") instance=ExtResource("83_rri8m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2276, 1, 5.26922)
|
||||
IsEnabled = true
|
||||
Target = NodePath("../Teleporter")
|
||||
|
||||
[node name="Enemies" type="Node3D" parent="."]
|
||||
|
||||
[node name="FloorEmitter" parent="Enemies" instance=ExtResource("63_r8ono")]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,31 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dbv1l74q66rdr"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dbv1l74q66rdr"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dnofvejpr6lvx" path="res://3D/BlockbenchModels/Teleporter/Teleporter.gltf" id="1_1cq1b"]
|
||||
[ext_resource type="Script" uid="uid://dmpd31aphufg7" path="res://Scripts/Activables/3D/Teleporter3D.cs" id="1_3138p"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_jvaa5"]
|
||||
size = Vector3(0.855408, 0.0598755, 0.878296)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_5c8o5"]
|
||||
height = 0.949707
|
||||
radius = 0.257813
|
||||
|
||||
[node name="Teleporter" type="StaticBody3D"]
|
||||
script = ExtResource("1_3138p")
|
||||
TeleportOffset = Vector3(0, 0.4, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00344848, 0.0288237, 0.000671387)
|
||||
shape = SubResource("BoxShape3D_jvaa5")
|
||||
|
||||
[node name="blockbench_export" parent="." instance=ExtResource("1_1cq1b")]
|
||||
|
||||
[node name="TeleporterTrigger" type="Area3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TeleporterTrigger"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.525146, 0)
|
||||
shape = SubResource("CylinderShape3D_5c8o5")
|
||||
|
||||
[connection signal="body_entered" from="TeleporterTrigger" to="." method="_on_body_entered"]
|
||||
|
|
|
|||
26
ExternalMaterial/Barrel/Barrel.mtl
Normal file
26
ExternalMaterial/Barrel/Barrel.mtl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Pixel Composer
|
||||
newmtl mat.1
|
||||
Kd 1.00 1.00 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 0.00
|
||||
Ni 1.00
|
||||
d 1.00
|
||||
illum 0
|
||||
map_Kd D:\Maddo\cirnogodot\ExternalMaterial\Barrel/Barrel_texture1.png
|
||||
newmtl mat.2
|
||||
Kd 1.00 1.00 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 0.00
|
||||
Ni 1.00
|
||||
d 1.00
|
||||
illum 0
|
||||
map_Kd D:\Maddo\cirnogodot\ExternalMaterial\Barrel/Barrel_texture2.png
|
||||
newmtl mat.3
|
||||
Kd 1.00 1.00 1.00
|
||||
Ks 0.00 0.00 0.00
|
||||
Ns 0.00
|
||||
Ni 1.00
|
||||
d 1.00
|
||||
illum 0
|
||||
map_Kd D:\Maddo\cirnogodot\ExternalMaterial\Barrel/Barrel_texture2.png
|
||||
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
# Pixel Composer
|
||||
mtllib Barrel.mtl
|
||||
o shape0
|
||||
usemtl mat.1
|
||||
v 0.39298 0.30914 -0.50000
|
||||
v 0.39298 0.30914 0.50000
|
||||
v 0.18576 0.46421 -0.50000
|
||||
|
|
@ -91,6 +93,7 @@ f 23/23/12 24/24/12 1/25/1
|
|||
f 24/24/12 2/26/1 1/25/1
|
||||
|
||||
o shape1
|
||||
usemtl mat.2
|
||||
v 0.00000 0.00000 -0.50000
|
||||
|
||||
vn 0.00000 0.00000 -1.00000
|
||||
|
|
@ -121,6 +124,7 @@ f 25/27/13 21/36/13 23/37/13
|
|||
f 25/27/13 23/37/13 1/28/13
|
||||
|
||||
o shape2
|
||||
usemtl mat.3
|
||||
v -0.00000 -0.00000 0.50000
|
||||
|
||||
vn -0.00000 -0.00000 1.00000
|
||||
|
|
|
|||
BIN
ExternalMaterial/Barrel/Barrel_texture1.png
(Stored with Git LFS)
Normal file
BIN
ExternalMaterial/Barrel/Barrel_texture1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
ExternalMaterial/Barrel/Barrel_texture1.png.import
Normal file
34
ExternalMaterial/Barrel/Barrel_texture1.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cl0jvx7ipwvbh"
|
||||
path="res://.godot/imported/Barrel_texture1.png-f9b8b7add393edcb26b1f24ca363265b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ExternalMaterial/Barrel/Barrel_texture1.png"
|
||||
dest_files=["res://.godot/imported/Barrel_texture1.png-f9b8b7add393edcb26b1f24ca363265b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
ExternalMaterial/Barrel/Barrel_texture2.png
(Stored with Git LFS)
Normal file
BIN
ExternalMaterial/Barrel/Barrel_texture2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
ExternalMaterial/Barrel/Barrel_texture2.png.import
Normal file
34
ExternalMaterial/Barrel/Barrel_texture2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bn0sxcg0mki7a"
|
||||
path="res://.godot/imported/Barrel_texture2.png-81cb8e0274ad6253af45636fe5a85f3f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ExternalMaterial/Barrel/Barrel_texture2.png"
|
||||
dest_files=["res://.godot/imported/Barrel_texture2.png-81cb8e0274ad6253af45636fe5a85f3f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=63 format=3 uid="uid://rimplblbptcd"]
|
||||
[gd_scene load_steps=66 format=3 uid="uid://rimplblbptcd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://88smibkin17p" path="res://Scripts/Components/FSM/3DPlayer/IsoPlayerFSMProxy.cs" id="1_cc7e7"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="1_vex34"]
|
||||
|
|
@ -7,12 +7,15 @@
|
|||
[ext_resource type="Script" uid="uid://d3ydlcdm8m3tg" path="res://Scripts/Components/FSM/3DPlayer/Active.cs" id="3_cc7e7"]
|
||||
[ext_resource type="Script" uid="uid://c5brx3ail1tlh" path="res://Scripts/Components/FSM/3DPlayer/IsoMovementModule.cs" id="5_fg04g"]
|
||||
[ext_resource type="Script" uid="uid://cmafvigtkg2qo" path="res://Scripts/Components/FSM/3DPlayer/Dead.cs" id="5_ok250"]
|
||||
[ext_resource type="Script" uid="uid://ci87ilsfrj1xh" path="res://Scripts/Components/FSM/3DPlayer/Cutscene.cs" id="6_chmen"]
|
||||
[ext_resource type="Script" uid="uid://eop2ue3otxcs" path="res://Scripts/Components/FSM/3DPlayer/IsoPlayerStorageModule.cs" id="6_habpy"]
|
||||
[ext_resource type="Script" uid="uid://cq1joxgoj3jdp" path="res://Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs" id="6_onfm2"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c6exoa8pxbc6w" path="res://Resources/Sprites/player_float.tres" id="6_yq7h2"]
|
||||
[ext_resource type="Script" uid="uid://dq338w2lw5phl" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="7_4cdxq"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://byb4cbb23cawf" path="res://Resources/Sprites/player_float_legs.tres" id="7_l4f8l"]
|
||||
[ext_resource type="Script" uid="uid://dls68t7f8eoqb" path="res://Scripts/Components/FSM/3DPlayer/Teleporting.cs" id="7_nwocn"]
|
||||
[ext_resource type="Material" uid="uid://dsrsfpcpwmaql" path="res://Resources/Materials/Player_Blink_Teleport_Material_3D.tres" id="7_yarib"]
|
||||
[ext_resource type="Script" uid="uid://bayjsi428yx83" path="res://Scripts/Components/FSM/3DPlayer/UnTeleporting.cs" id="8_nk07c"]
|
||||
[ext_resource type="Script" uid="uid://1fryvj4omkin" path="res://Scripts/Components/Actors/MouseAimProvider3D.cs" id="9_2ffwi"]
|
||||
[ext_resource type="Script" uid="uid://c8ar11sg0su2h" path="res://Scripts/Components/FSM/3DPlayer/ShadowModule.cs" id="9_fg04g"]
|
||||
[ext_resource type="Script" uid="uid://ceiworv2pgl1r" path="res://Scripts/Components/Actors/3D/AnimatedShaderSprite3D.cs" id="9_yarib"]
|
||||
|
|
@ -221,6 +224,19 @@ _moduleNodes = [NodePath("../../InputProvider"), NodePath("../../MovementModule"
|
|||
[node name="Dead" type="Node" parent="StateMachine"]
|
||||
script = ExtResource("5_ok250")
|
||||
|
||||
[node name="Cutscene" type="Node" parent="StateMachine" node_paths=PackedStringArray("AnimationProvider", "PlayerStorage")]
|
||||
script = ExtResource("6_chmen")
|
||||
AnimationProvider = NodePath("../../AnimationProvider")
|
||||
PlayerStorage = NodePath("../../Storage")
|
||||
|
||||
[node name="Teleporting" type="Node" parent="StateMachine" node_paths=PackedStringArray("AnimationProvider")]
|
||||
script = ExtResource("7_nwocn")
|
||||
AnimationProvider = NodePath("../../AnimationProvider")
|
||||
|
||||
[node name="UnTeleporting" type="Node" parent="StateMachine" node_paths=PackedStringArray("AnimationProvider")]
|
||||
script = ExtResource("8_nk07c")
|
||||
AnimationProvider = NodePath("../../AnimationProvider")
|
||||
|
||||
[node name="AnimationProvider" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite")]
|
||||
script = ExtResource("6_onfm2")
|
||||
AnimatedSprite = NodePath("AnimatedSprite3D")
|
||||
|
|
|
|||
197
Scripts/Activables/3D/Teleporter3D.cs
Normal file
197
Scripts/Activables/3D/Teleporter3D.cs
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
using Godot;
|
||||
using GTweensGodot.Extensions;
|
||||
|
||||
namespace Cirno.Scripts.Activables._3D;
|
||||
|
||||
[Tool]
|
||||
public partial class Teleporter3D : StaticBody3D, IActivable
|
||||
{
|
||||
[Export] public bool IsEnabled { get; set; }
|
||||
|
||||
[Export] public bool Invisible { get; set; } = false;
|
||||
|
||||
public bool IsPrimed { get; private set; }
|
||||
|
||||
[Export] public Teleporter3D Target { get; set; }
|
||||
|
||||
[Export] public float ParticleEmitTime { get; private set; } = 2f;
|
||||
|
||||
[Export] public float TeleportAnimationLength { get; private set; } = 0.5f;
|
||||
[Export] public Vector3 TeleportOffset { get; private set; } = new Vector3(0, 4f, 0);
|
||||
|
||||
[ExportCategory("Animations")]
|
||||
[Export]
|
||||
public StringName ActiveAnimationName { get; private set; } = "Active";
|
||||
|
||||
[Export] public StringName DefaultAnimationName { get; private set; } = "Default";
|
||||
|
||||
private void PlayAnimation(StringName name)
|
||||
{
|
||||
}
|
||||
|
||||
private void StopParticles()
|
||||
{
|
||||
// _particles.Emitting = false;
|
||||
// _particleTimer = 0;
|
||||
}
|
||||
|
||||
private void EmitParticles()
|
||||
{
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
PlayAnimation(IsEnabled ? ActiveAnimationName : DefaultAnimationName);
|
||||
|
||||
if (Engine.IsEditorHint()) return;
|
||||
|
||||
|
||||
IsPrimed = true;
|
||||
StopParticles();
|
||||
|
||||
this.Visible = !Invisible;
|
||||
|
||||
// _teleportStartSound = GetNodeOrNull<AudioStreamPlayer2D>("TeleportStart");
|
||||
// _teleportEndSound = GetNodeOrNull<AudioStreamPlayer2D>("TeleportEnd");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
// if (!_particles.Emitting) return;
|
||||
//
|
||||
// _particleTimer += delta;
|
||||
//
|
||||
// if (_particleTimer >= ParticleEmitTime)
|
||||
// {
|
||||
// _particleTimer = 0;
|
||||
// _particles.Emitting = false;
|
||||
// }
|
||||
}
|
||||
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
case ActivationType.Toggle:
|
||||
// Enables/Disables teleporter
|
||||
break;
|
||||
case ActivationType.Enable:
|
||||
// Enables Teleporter
|
||||
IsEnabled = true;
|
||||
PlayAnimation(ActiveAnimationName);
|
||||
break;
|
||||
case ActivationType.Disable:
|
||||
IsEnabled = false;
|
||||
PlayAnimation(DefaultAnimationName);
|
||||
// Disables Teleporter
|
||||
break;
|
||||
case ActivationType.Use:
|
||||
// Teleports
|
||||
break;
|
||||
case ActivationType.Destroy:
|
||||
// Destroys
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void PrepareForReceiving()
|
||||
{
|
||||
IsPrimed = false;
|
||||
EmitParticles();
|
||||
}
|
||||
|
||||
public void FireParticles()
|
||||
{
|
||||
EmitParticles();
|
||||
}
|
||||
|
||||
private void _on_body_entered(Node3D body)
|
||||
{
|
||||
GD.Print("Something entered the teleporter");
|
||||
if (!IsEnabled) return;
|
||||
if (body is not IsoPlayerFSMProxy player) return;
|
||||
GD.Print("Player entered the teleporter");
|
||||
|
||||
if (!IsPrimed)
|
||||
{
|
||||
IsPrimed = true;
|
||||
//_particles.Emitting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Teleport player to target if active
|
||||
if (!IsEnabled) return;
|
||||
|
||||
GD.Print("Teleporting...");
|
||||
|
||||
// Call Teleport here
|
||||
_ = Teleport(player.PlayerFSM);
|
||||
}
|
||||
|
||||
protected virtual async Task Teleport(IsoPlayerStateMachine player)
|
||||
{
|
||||
if (Target is null) return;
|
||||
//player.RequestMovementDisable(true);
|
||||
player.SetState(PlayerState.Cutscene);
|
||||
|
||||
await TweenPlayer(player.MainObject);
|
||||
|
||||
PlayTeleportStartSound();
|
||||
|
||||
//_particles.Emitting = true;
|
||||
FireParticles();
|
||||
|
||||
//await player.Teleport();
|
||||
player.SetState(PlayerState.Teleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||
|
||||
Target.PrepareForReceiving();
|
||||
player.MainObject.GlobalPosition = Target.GlobalPosition + TeleportOffset;
|
||||
Target.PlayTeleportEndSound();
|
||||
//await player.UnTeleport();
|
||||
|
||||
player.SetState(PlayerState.UnTeleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
//player.RequestMovementDisable(false);
|
||||
player.SetState(PlayerState.Active);
|
||||
}
|
||||
|
||||
public void PlayTeleportStartSound()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void PlayTeleportEndSound()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected async Task TweenPlayer(CharacterBody3D player)
|
||||
{
|
||||
await player.TweenGlobalPosition(GlobalPosition + TeleportOffset, TeleportAnimationLength)
|
||||
.PlayAsync(CancellationToken.None);
|
||||
|
||||
// Create a Tween for the teleport animation
|
||||
// Tween tween = GetTree().CreateTween();
|
||||
// tween.SetEase(Tween.EaseType.InOut);
|
||||
// tween.SetTrans(Tween.TransitionType.Sine);
|
||||
// tween.TweenProperty(player, "global_position", GlobalPosition + new Vector2(0,-4f), TeleportAnimationLength);
|
||||
//
|
||||
// // Wait for the tween to finish
|
||||
// await ToSignal(tween, "finished");
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
}
|
||||
}
|
||||
1
Scripts/Activables/3D/Teleporter3D.cs.uid
Normal file
1
Scripts/Activables/3D/Teleporter3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dmpd31aphufg7
|
||||
54
Scripts/Components/FSM/3DPlayer/Cutscene.cs
Normal file
54
Scripts/Components/FSM/3DPlayer/Cutscene.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using Cirno.Scripts.Components.Actors._3D;
|
||||
using Cirno.Scripts.Components.FSM.Player;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
|
||||
public partial class Cutscene : BaseState<PlayerState, CharacterBody3D>
|
||||
{
|
||||
public override PlayerState StateId => PlayerState.Cutscene;
|
||||
|
||||
[Export] public PlayerAnimationProvider3D AnimationProvider { get; set; }
|
||||
|
||||
[Export] public IsoPlayerStorageModule PlayerStorage { get; private set; }
|
||||
|
||||
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
|
||||
{
|
||||
base.Init(machine);
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
MainObject.Show();
|
||||
MainObject.Velocity = Vector3.Zero;
|
||||
PlayerStorage.MovementDirection = Vector3.Zero;
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
AnimationProvider.SetAnimationSpeed(Vector2.Zero);
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
AnimationProvider.SetAnimationSpeed(MainObject.Velocity.ToVector2());
|
||||
AnimationProvider.SetAnimation(MainObject.Velocity.ToVector2());
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
// Reset at start of frame
|
||||
//MainObject.Velocity = Vector2.Zero;
|
||||
|
||||
// Process modules
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Scripts/Components/FSM/3DPlayer/Cutscene.cs.uid
Normal file
1
Scripts/Components/FSM/3DPlayer/Cutscene.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ci87ilsfrj1xh
|
||||
|
|
@ -74,7 +74,6 @@ public partial class IsoMovementModule : ModuleBase<PlayerState, CharacterBody3D
|
|||
|
||||
public override void PhysicsProcess(double delta)
|
||||
{
|
||||
|
||||
var frameVelocity = MainObject.Velocity;
|
||||
|
||||
if (_isStrafing)
|
||||
|
|
|
|||
46
Scripts/Components/FSM/3DPlayer/Teleporting.cs
Normal file
46
Scripts/Components/FSM/3DPlayer/Teleporting.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using Cirno.Scripts.Components.Actors._3D;
|
||||
using Cirno.Scripts.Components.FSM.Player;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
|
||||
public partial class Teleporting : BaseState<PlayerState, CharacterBody3D>
|
||||
{
|
||||
public override PlayerState StateId => PlayerState.Teleporting;
|
||||
|
||||
[Export] public PlayerAnimationProvider3D AnimationProvider { get; set; }
|
||||
|
||||
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
|
||||
{
|
||||
base.Init(machine);
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
AnimationProvider.PlayTeleportAnimation();
|
||||
MainObject.Velocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
// Process modules
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Scripts/Components/FSM/3DPlayer/Teleporting.cs.uid
Normal file
1
Scripts/Components/FSM/3DPlayer/Teleporting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dls68t7f8eoqb
|
||||
45
Scripts/Components/FSM/3DPlayer/UnTeleporting.cs
Normal file
45
Scripts/Components/FSM/3DPlayer/UnTeleporting.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using Cirno.Scripts.Components.Actors._3D;
|
||||
using Cirno.Scripts.Components.FSM.Player;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
|
||||
public partial class UnTeleporting : BaseState<PlayerState, CharacterBody3D>
|
||||
{
|
||||
public override PlayerState StateId => PlayerState.UnTeleporting;
|
||||
|
||||
[Export] public PlayerAnimationProvider3D AnimationProvider { get; set; }
|
||||
|
||||
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
|
||||
{
|
||||
base.Init(machine);
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
AnimationProvider.PlayUnteleportAnimation();
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
// Process modules
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Scripts/Components/FSM/3DPlayer/UnTeleporting.cs.uid
Normal file
1
Scripts/Components/FSM/3DPlayer/UnTeleporting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bayjsi428yx83
|
||||
Loading…
Add table
Add a link
Reference in a new issue