mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Changed player to new one
This commit is contained in:
parent
60ab375572
commit
1c1436a539
27 changed files with 323 additions and 87 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=35 format=3 uid="uid://c4pr2707hbeph"]
|
||||
[gd_scene load_steps=39 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"]
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
[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="Script" uid="uid://br2ev58gwuvu4" path="res://Scripts/Components/FSM/Player/UnTeleporting.cs" id="6_7n10g"]
|
||||
[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"]
|
||||
|
|
@ -21,11 +22,13 @@
|
|||
[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="Texture2D" uid="uid://bc4tp44e00g0d" path="res://Sprites/Actors/Focus_Square.png" id="20_3ho10"]
|
||||
[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"]
|
||||
radius = 5.0
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_0pqs8"]
|
||||
particle_flag_disable_z = true
|
||||
|
|
@ -66,6 +69,21 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vwjki"]
|
||||
atlas = ExtResource("20_3ho10")
|
||||
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("13_pmkfo")
|
||||
region = Rect2(0, 0, 4, 4)
|
||||
|
|
@ -118,16 +136,23 @@ script = ExtResource("5_yifvs")
|
|||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 3
|
||||
|
||||
[node name="Controlling" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("6_82vrk")
|
||||
[node name="UnTeleporting" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("6_7n10g")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 4
|
||||
|
||||
[node name="Dead" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("4_0pqs8")
|
||||
[node name="Controlling" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("6_82vrk")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
State = 5
|
||||
|
||||
[node name="Dead" type="Node2D" parent="." node_paths=PackedStringArray("_animationProvider", "_inputProvider", "_healthProvider")]
|
||||
script = ExtResource("4_0pqs8")
|
||||
_animationProvider = NodePath("../AnimationProvider")
|
||||
_inputProvider = NodePath("../InputProvider")
|
||||
_healthProvider = NodePath("../DamageReceiver/HealthProvider")
|
||||
State = 6
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_b3hxm")
|
||||
|
||||
|
|
@ -165,16 +190,22 @@ 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")]
|
||||
[node name="StrafeSpriteProvider" type="Node2D" parent="." node_paths=PackedStringArray("Hitbox", "Circle", "Square")]
|
||||
show_behind_parent = true
|
||||
script = ExtResource("10_gp3hw")
|
||||
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")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
[gd_scene load_steps=24 format=4 uid="uid://dqyfnby0t7gu1"]
|
||||
[gd_scene load_steps=31 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"]
|
||||
[ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="3_6314l"]
|
||||
[ext_resource type="Script" uid="uid://mja0rk7n2kln" path="res://Scripts/Resources/MapStartDataResource.cs" id="4_u1i8n"]
|
||||
[ext_resource type="Resource" uid="uid://dhbltvgsa3g88" path="res://Resources/Items/Spider_Bomb_Pickup.tres" id="4_yyg8m"]
|
||||
|
|
@ -20,8 +19,16 @@
|
|||
[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="PackedScene" uid="uid://r25rq6ijgm6m" path="res://Scenes/Items/Green_Keycard.tscn" id="16_dj0ui"]
|
||||
[ext_resource type="PackedScene" uid="uid://byms2dhliyux0" path="res://Scenes/Actors/teleporter.tscn" id="16_qmakk"]
|
||||
[ext_resource type="Resource" uid="uid://bj331rcsq65es" path="res://Resources/Bullets/EmitterTestBullet.tres" id="16_u1i8n"]
|
||||
[ext_resource type="PackedScene" uid="uid://bj28qiai2x2ar" path="res://Scenes/Props/Barrel.tscn" id="17_qmakk"]
|
||||
[ext_resource type="PackedScene" uid="uid://djf0y08ix66fn" path="res://Scenes/Interactable/Chest.tscn" id="18_v2gcl"]
|
||||
[ext_resource type="Resource" uid="uid://cfq121rs3bsu8" path="res://Resources/Items/Cheat_Gun_Item.tres" id="19_1ajuh"]
|
||||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="20_0knpf"]
|
||||
[ext_resource type="Resource" uid="uid://cj5aa7btaw6q0" path="res://Resources/Items/Blue_Keycard.tres" id="20_rff8l"]
|
||||
[ext_resource type="Resource" uid="uid://dibquna7fww7t" path="res://Resources/Items/Red_Keycard.tres" id="21_cub4j"]
|
||||
[ext_resource type="Resource" uid="uid://dau0s8ob7qnpc" path="res://Resources/Items/IceShotgun.tres" id="22_4gtx8"]
|
||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="23_1ajuh"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6wo78"]
|
||||
script = ExtResource("4_u1i8n")
|
||||
|
|
@ -31,7 +38,7 @@ StartingEquipment = Array[ExtResource("5_u1i8n")]([])
|
|||
[node name="GameScene" type="Node2D"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_c3v4x")
|
||||
PlayerTemplate = ExtResource("2_w1v1g")
|
||||
PlayerTemplate = ExtResource("8_c3v4x")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("PlayerStartPosition")
|
||||
})
|
||||
|
|
@ -58,11 +65,9 @@ tile_set = ExtResource("5_6314l")
|
|||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Actors" type="Node2D" parent="Tilemaps"]
|
||||
y_sort_enabled = true
|
||||
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)
|
||||
|
||||
|
|
@ -84,6 +89,23 @@ Targets = [NodePath("../HorizontalForceField")]
|
|||
[node name="GreenKeyCard" parent="Tilemaps/Actors" instance=ExtResource("16_dj0ui")]
|
||||
position = Vector2(154, 339)
|
||||
|
||||
[node name="Teleporter2" parent="Tilemaps/Actors" node_paths=PackedStringArray("Target") instance=ExtResource("16_qmakk")]
|
||||
position = Vector2(119, 391)
|
||||
IsEnabled = true
|
||||
Target = NodePath("../Teleporter4")
|
||||
|
||||
[node name="Teleporter4" parent="Tilemaps/Actors" node_paths=PackedStringArray("Target") instance=ExtResource("16_qmakk")]
|
||||
position = Vector2(183, 391)
|
||||
IsEnabled = true
|
||||
Target = NodePath("../Teleporter2")
|
||||
|
||||
[node name="Barrel" parent="Tilemaps/Actors" instance=ExtResource("17_qmakk")]
|
||||
position = Vector2(59, 386)
|
||||
|
||||
[node name="Chest" parent="Tilemaps/Actors" instance=ExtResource("18_v2gcl")]
|
||||
position = Vector2(56, 320)
|
||||
LootTable = Array[ExtResource("5_u1i8n")]([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="CameraController" type="Camera2D" parent="."]
|
||||
process_mode = 1
|
||||
script = ExtResource("9_dj0ui")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=121 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=120 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ksslq"]
|
||||
[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="3_kgs2x"]
|
||||
[ext_resource type="Script" uid="uid://krean0uywtms" path="res://Scripts/TilemapAvoidance.cs" id="4_p1fl3"]
|
||||
[ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"]
|
||||
|
|
@ -80,7 +80,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dfat0erkvb513" path="res://Scenes/Actors/Fairy_New.tscn" id="73_s4x1s"]
|
||||
[ext_resource type="PackedScene" uid="uid://c21m7w5ahpsd0" path="res://Scenes/Activable/Shroud.tscn" id="74_oaf68"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3tyacxxw88lx" path="res://Scenes/Utils/StreamPlayerWithName.tscn" id="77_yot54"]
|
||||
[ext_resource type="AudioStream" uid="uid://blohh20jktoyo" path="res://SFX/270641__phantastonia__alarm2.wav" id="79_jn1m0"]
|
||||
[ext_resource type="Resource" uid="uid://b0jpn0kkmciuq" path="res://Resources/Music/Overtime_Fairy_Dance.tres" id="82_ksslq"]
|
||||
[ext_resource type="PackedScene" uid="uid://cvctgw8eo2f7e" path="res://Scenes/Items/SpiderBomb_Pickup.tscn" id="83_jn1m0"]
|
||||
|
||||
|
|
@ -470,13 +469,13 @@ metadata/_custom_type_script = "uid://dslyrfcej3g2n"
|
|||
[node name="GameScene" type="Node2D"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_8tmoj")
|
||||
PlayerTemplate = ExtResource("2_8mh54")
|
||||
PlayerTemplate = ExtResource("2_ksslq")
|
||||
SpawnMarkers = Dictionary[int, NodePath]({
|
||||
0: NodePath("Factory Tilemaps/LevelProps/StartPosition"),
|
||||
2: NodePath("Factory Tilemaps/LevelProps/BossDebugTeleporterDestination"),
|
||||
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")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
|
|
@ -1156,7 +1155,6 @@ script = ExtResource("18_dvo37")
|
|||
process_mode = 1
|
||||
position = Vector2(-4, 0)
|
||||
script = ExtResource("25_rpwvt")
|
||||
AlarmSound = ExtResource("79_jn1m0")
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("22_krk0o")]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
|
@ -10,16 +11,19 @@ public partial class LevelTeleporter : Teleporter
|
|||
[Export]
|
||||
public string LevelPath {get; private set;}
|
||||
|
||||
protected override async Task Teleport(PlayerMovement player)
|
||||
protected override async Task Teleport(PlayerStateMachine player)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(LevelPath)) return;
|
||||
player.RequestMovementDisable(true);
|
||||
//player.RequestMovementDisable(true);
|
||||
player.SetState((int)PlayerState.Cutscene);
|
||||
|
||||
await TweenPlayer(player);
|
||||
|
||||
_particles.Emitting = true;
|
||||
|
||||
await player.Teleport();
|
||||
//await player.Teleport();
|
||||
player.SetState((int)PlayerState.UnTeleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ public partial class PlayerMover : ChainActivable
|
|||
|
||||
private async Task MovePlayer()
|
||||
{
|
||||
_gameManager.Player.RequestMovementDisable(true);
|
||||
//_gameManager.Player.RequestMovementDisable(true);
|
||||
_gameManager.Player.SetState((int)PlayerState.Cutscene);
|
||||
|
||||
Tween tween = GetTree().CreateTween();
|
||||
tween.SetEase(EaseType);
|
||||
|
|
@ -46,7 +47,8 @@ public partial class PlayerMover : ChainActivable
|
|||
// Wait for the tween to finish
|
||||
await ToSignal(tween, "finished");
|
||||
|
||||
_gameManager.Player.RequestMovementDisable(false);
|
||||
//_gameManager.Player.RequestMovementDisable(false);
|
||||
_gameManager.Player.SetState((int)PlayerState.Cutscene);
|
||||
|
||||
ActivateTargets();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Godot;
|
||||
using GTweensGodot.Extensions;
|
||||
|
||||
|
|
@ -115,7 +116,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
|
||||
private void _on_body_entered(CharacterBody2D area)
|
||||
{
|
||||
if (area is not PlayerMovement player) return;
|
||||
if (area is not PlayerStateMachine player) return;
|
||||
|
||||
if (!IsPrimed)
|
||||
{
|
||||
|
|
@ -132,10 +133,11 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
_ = Teleport(player);
|
||||
}
|
||||
|
||||
protected virtual async Task Teleport(PlayerMovement player)
|
||||
protected virtual async Task Teleport(PlayerStateMachine player)
|
||||
{
|
||||
if (Target is null) return;
|
||||
player.RequestMovementDisable(true);
|
||||
//player.RequestMovementDisable(true);
|
||||
player.SetState((int)PlayerState.Cutscene);
|
||||
|
||||
await TweenPlayer(player);
|
||||
|
||||
|
|
@ -144,16 +146,22 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
//_particles.Emitting = true;
|
||||
FireParticles();
|
||||
|
||||
await player.Teleport();
|
||||
//await player.Teleport();
|
||||
player.SetState((int)PlayerState.Teleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||
|
||||
Target.PrepareForReceiving();
|
||||
player.GlobalPosition = Target.GlobalPosition + TeleportOffset;
|
||||
Target.PlayTeleportEndSound();
|
||||
await player.UnTeleport();
|
||||
//await player.UnTeleport();
|
||||
|
||||
player.RequestMovementDisable(false);
|
||||
player.SetState((int)PlayerState.UnTeleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
//player.RequestMovementDisable(false);
|
||||
player.SetState((int)PlayerState.Active);
|
||||
}
|
||||
|
||||
public void PlayTeleportStartSound()
|
||||
|
|
@ -166,7 +174,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
_teleportEndSound?.Play();
|
||||
}
|
||||
|
||||
protected async Task TweenPlayer(PlayerMovement player)
|
||||
protected async Task TweenPlayer(PlayerStateMachine player)
|
||||
{
|
||||
await player.TweenGlobalPosition(GlobalPosition + new Vector2(0, -4f), TeleportAnimationLength).PlayAsync(CancellationToken.None);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ public partial class EnemyPossessionMovement : ActorFreeMovement
|
|||
public void AssumeControl()
|
||||
{
|
||||
GameManager.Instance.CameraTargetObject(_parent);
|
||||
GameManager.Instance.Player.RequestMovementDisable(true);
|
||||
//GameManager.Instance.Player.RequestMovementDisable(true);
|
||||
GameManager.Instance.Player.SetState((int)PlayerState.Controlling);
|
||||
|
||||
_previousAiState = _actorAi.Ai;
|
||||
_actorAi.Ai = AiState.Controlled;
|
||||
|
|
@ -92,7 +93,8 @@ public partial class EnemyPossessionMovement : ActorFreeMovement
|
|||
_actorAi.Ai = _previousAiState;
|
||||
|
||||
GameManager.Instance.CameraTargetPlayer();
|
||||
GameManager.Instance.Player.RequestMovementDisable(false);
|
||||
//GameManager.Instance.Player.RequestMovementDisable(false);
|
||||
GameManager.Instance.Player.SetState((int)PlayerState.Active);
|
||||
|
||||
DamageReceiver.BulletGroup = BulletOwner.Enemy;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,33 +6,33 @@ public partial class KeyboardInputProvider : InputProvider
|
|||
{
|
||||
[ExportCategory("Movement")]
|
||||
[Export]
|
||||
public string LeftAxisName { get; private set; } = "left";
|
||||
public StringName LeftAxisName { get; private set; } = "left";
|
||||
[Export]
|
||||
public string RightAxisName { get; private set; } = "right";
|
||||
public StringName RightAxisName { get; private set; } = "right";
|
||||
[Export]
|
||||
public string UpAxisName { get; private set; } = "up";
|
||||
public StringName UpAxisName { get; private set; } = "up";
|
||||
[Export]
|
||||
public string DownAxisName { get; private set; } = "down";
|
||||
public StringName DownAxisName { get; private set; } = "down";
|
||||
|
||||
[ExportCategory("Aiming")]
|
||||
[Export]
|
||||
public string LeftAimName { get; private set; } = "aim_left";
|
||||
public StringName LeftAimName { get; private set; } = "aim_left";
|
||||
[Export]
|
||||
public string RightAimName { get; private set; } = "aim_right";
|
||||
public StringName RightAimName { get; private set; } = "aim_right";
|
||||
[Export]
|
||||
public string UpAimName { get; private set; } = "aim_up";
|
||||
public StringName UpAimName { get; private set; } = "aim_up";
|
||||
[Export]
|
||||
public string DownAimName { get; private set; } = "aim_down";
|
||||
public StringName DownAimName { get; private set; } = "aim_down";
|
||||
|
||||
[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";
|
||||
[Export] private string _inventoryActionName = "inventory";
|
||||
[Export] private string _pauseActionName = "pause";
|
||||
[Export] private StringName _shootActionName = "shoot";
|
||||
[Export] private StringName _useActionName = "Use";
|
||||
[Export] private StringName _scanActionName = "scan";
|
||||
[Export] private StringName _strafeActionName = "strafe";
|
||||
[Export] private StringName _nextWeaponActionName = "next_weapon";
|
||||
[Export] private StringName _previousWeaponActionName = "previous_weapon";
|
||||
[Export] private StringName _inventoryActionName = "inventory";
|
||||
[Export] private StringName _pauseActionName = "pause";
|
||||
|
||||
public override Vector2 GetMovementInput()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,21 +16,33 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
|
||||
[ExportCategory("Animation Names")]
|
||||
[Export]
|
||||
public string WalkRightAnimationName {get; private set;} = "walk_right";
|
||||
public StringName WalkRightAnimationName {get; private set;} = "walk_right";
|
||||
|
||||
[Export]
|
||||
public string WalkLeftAnimationName {get; private set;} = "walk_left";
|
||||
public StringName WalkLeftAnimationName {get; private set;} = "walk_left";
|
||||
[Export]
|
||||
public string WalkDownAnimationName {get; private set;} = "walk_down";
|
||||
public StringName WalkDownAnimationName {get; private set;} = "walk_down";
|
||||
[Export]
|
||||
public string WalkUpAnimationName {get; private set;} = "walk_up";
|
||||
public StringName WalkUpAnimationName {get; private set;} = "walk_up";
|
||||
|
||||
[ExportCategory("Shaders")]
|
||||
[Export] public ShaderMaterial BlinkMaterial {get; private set;}
|
||||
|
||||
[Export] public StringName BlinkShaderPropertyName { get; private set; } = new StringName("blink_intensity");
|
||||
[Export] public StringName BlinkShaderPropertyName { get; private set; } = new("blink_intensity");
|
||||
[Export] public StringName TeleportProgressPropertyName { get; private set; } = new("teleport_progress");
|
||||
[Export] public StringName ScanlineDensityPropertyName { get; private set; } = new("scanline_density");
|
||||
|
||||
private GTween _blinkTween;
|
||||
|
||||
public void ShowSprite()
|
||||
{
|
||||
_animatedSprite.Show();
|
||||
}
|
||||
|
||||
public void HideSprite()
|
||||
{
|
||||
_animatedSprite.Hide();
|
||||
}
|
||||
|
||||
public void SetAnimation(Vector2 velocity)
|
||||
{
|
||||
|
|
@ -78,6 +90,38 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
public void PlayTeleportAnimation()
|
||||
{
|
||||
if (BlinkMaterial == null) return;
|
||||
_animatedSprite.Material = BlinkMaterial;
|
||||
var material = ((ShaderMaterial)_animatedSprite.Material);
|
||||
_blinkTween?.Kill();
|
||||
_blinkTween = GTweenSequenceBuilder.New()
|
||||
.Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 0f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,50f,0.5f))
|
||||
.Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f,0.5f))
|
||||
.Build();
|
||||
|
||||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
public void PlayUnteleportAnimation()
|
||||
{
|
||||
if (BlinkMaterial == null) return;
|
||||
_animatedSprite.Material = BlinkMaterial;
|
||||
var material = ((ShaderMaterial)_animatedSprite.Material);
|
||||
_blinkTween?.Kill();
|
||||
_blinkTween = GTweenSequenceBuilder.New()
|
||||
.Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 50f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,0f,0.5f))
|
||||
.Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f,0.5f))
|
||||
.Build();
|
||||
|
||||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
private void SetShaderTeleportProgress(float value)
|
||||
{
|
||||
((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("teleport_progress", value);
|
||||
|
|
@ -103,4 +147,6 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
{
|
||||
_shieldParticles.Emitting = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,9 +8,21 @@ public partial class PlayerHitboxSpriteProvider : Node2D
|
|||
public AnimatedSprite2D Hitbox { get; private set; }
|
||||
[Export]
|
||||
public AnimatedSprite2D Circle { get; private set; }
|
||||
[Export]
|
||||
public AnimatedSprite2D Square { get; private set; }
|
||||
|
||||
[Export] public float RotationSpeed { get; private set; } = 10f;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (!Visible) return;
|
||||
Circle.Rotate((float)(RotationSpeed * delta));
|
||||
Square.Rotate((float)(-RotationSpeed * delta));
|
||||
}
|
||||
|
||||
public void SetVisibility(bool isVisible)
|
||||
{
|
||||
if (isVisible == Visible) return;
|
||||
if (isVisible)
|
||||
{
|
||||
Show();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public partial class Active : PlayerFSMState
|
|||
// enable sprite
|
||||
// enable crosshair
|
||||
_crosshairProvider.Show();
|
||||
|
||||
_animationProvider.ShowSprite();
|
||||
_damageReceiver.Enabled = true;
|
||||
_activationProvider.Enabled = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ public partial class Cutscene : PlayerFSMState
|
|||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
_animationProvider.SetAnimation(Vector2.Zero);
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
_animationProvider.SetAnimation(_stateMachine.Velocity);
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public partial class Teleporting : PlayerFSMState
|
|||
|
||||
public override void EnterState()
|
||||
{
|
||||
|
||||
_animationProvider.PlayTeleportAnimation();
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
|
|
|
|||
29
Scripts/Components/FSM/Player/UnTeleporting.cs
Normal file
29
Scripts/Components/FSM/Player/UnTeleporting.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class UnTeleporting : PlayerFSMState
|
||||
{
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider.PlayUnteleportAnimation();
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/UnTeleporting.cs.uid
Normal file
1
Scripts/Components/FSM/Player/UnTeleporting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://br2ev58gwuvu4
|
||||
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot.Collections;
|
||||
using Cirno.Scripts.Utils;
|
||||
|
|
@ -12,11 +13,11 @@ public partial class GameManager : Node2D
|
|||
public static GameManager Instance { get; private set; }
|
||||
private Hud _hud;
|
||||
|
||||
private PlayerMovement _player;
|
||||
private PlayerStateMachine _player;
|
||||
|
||||
public GameState GameState { get; private set; }
|
||||
|
||||
public PlayerMovement Player => _player;
|
||||
public PlayerStateMachine Player => _player;
|
||||
|
||||
private Node2D _cameraTarget;
|
||||
|
||||
|
|
@ -132,17 +133,17 @@ public partial class GameManager : Node2D
|
|||
|
||||
if (_player != null && _hud != null)
|
||||
{
|
||||
_player.HealthChanged += (newHealth, maxHealth) => _hud.UpdateHealth(newHealth, maxHealth);
|
||||
|
||||
_player.ShieldChanged += (newShield, maxShield) => _hud.UpdateShield(newShield, maxShield);
|
||||
|
||||
_player.InteractableAreaEntered += (interactable) => _hud.UpdateInteractable(interactable);
|
||||
|
||||
_player.Death += () =>
|
||||
{
|
||||
// Show Game Over
|
||||
_hud.ShowGameOver();
|
||||
};
|
||||
// _player.HealthChanged += (newHealth, maxHealth) => _hud.UpdateHealth(newHealth, maxHealth);
|
||||
//
|
||||
// _player.ShieldChanged += (newShield, maxShield) => _hud.UpdateShield(newShield, maxShield);
|
||||
//
|
||||
// _player.InteractableAreaEntered += (interactable) => _hud.UpdateInteractable(interactable);
|
||||
//
|
||||
// _player.Death += () =>
|
||||
// {
|
||||
// // Show Game Over
|
||||
// _hud.ShowGameOver();
|
||||
// };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -159,7 +160,7 @@ public partial class GameManager : Node2D
|
|||
if (_player != null) return;
|
||||
|
||||
//_player = this.CreateChild<PlayerMovement>(PlayerTemplate, PlayerSpawnMarker.Position );
|
||||
_player = PlayerTemplate.Instantiate<PlayerMovement>();
|
||||
_player = PlayerTemplate.Instantiate<PlayerStateMachine>();
|
||||
|
||||
this.CallDeferred("add_child", _player);
|
||||
_player.Transform = this.GlobalTransform;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ public partial class Hud : CanvasLayer
|
|||
|
||||
public void HideGameOver()
|
||||
{
|
||||
|
||||
_gameOverPanel.Hide();
|
||||
_playerDead = false;
|
||||
}
|
||||
|
||||
public void UpdateHealth(float newHealth, float maxHealth)
|
||||
|
|
|
|||
|
|
@ -585,6 +585,7 @@ public enum PlayerState
|
|||
Active,
|
||||
Cutscene,
|
||||
Teleporting,
|
||||
UnTeleporting,
|
||||
Controlling,
|
||||
Dead,
|
||||
}
|
||||
|
|
@ -30,16 +30,18 @@ public partial class ControlEnemyEvent : EventResource
|
|||
if (_parent.GetNode<Node2D>(Target) is Enemy enemy)
|
||||
{
|
||||
_gameManager.CameraTargetObject(enemy);
|
||||
_gameManager.Player.RequestMovementDisable(true);
|
||||
GameManager.Instance.Player.SetState((int)PlayerState.Controlling);
|
||||
// _gameManager.Player.RequestMovementDisable(true);
|
||||
enemy.AssumeControl();
|
||||
if (_gameManager.Player.WingsSprite != null)
|
||||
{
|
||||
var sprite = new Sprite2D();
|
||||
sprite.SetTexture(_gameManager.Player.WingsSprite);
|
||||
//sprite.GlobalPosition = enemy.GlobalPosition;
|
||||
sprite.SetZIndex(1);
|
||||
enemy.CallDeferred("add_child", sprite);
|
||||
}
|
||||
// TODO: Do this on the enemy as a module instead
|
||||
// if (_gameManager.Player.WingsSprite != null)
|
||||
// {
|
||||
// var sprite = new Sprite2D();
|
||||
// sprite.SetTexture(_gameManager.Player.WingsSprite);
|
||||
// //sprite.GlobalPosition = enemy.GlobalPosition;
|
||||
// sprite.SetZIndex(1);
|
||||
// enemy.CallDeferred("add_child", sprite);
|
||||
// }
|
||||
}
|
||||
|
||||
_isComplete = true;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ public partial class MovePlayerEvent : EventResource
|
|||
|
||||
protected async Task MovePlayer()
|
||||
{
|
||||
_gameManager.Player.RequestMovementDisable(true);
|
||||
GameManager.Instance.Player.SetState((int)PlayerState.Cutscene);
|
||||
//_gameManager.Player.RequestMovementDisable(true);
|
||||
|
||||
Tween tween = _gameManager.GetTree().CreateTween();
|
||||
tween.SetEase(EaseType);
|
||||
|
|
@ -45,7 +46,8 @@ public partial class MovePlayerEvent : EventResource
|
|||
// Wait for the tween to finish
|
||||
await ToSignal(tween, "finished");
|
||||
|
||||
_gameManager.Player.RequestMovementDisable(false);
|
||||
GameManager.Instance.Player.SetState((int)PlayerState.Active);
|
||||
//_gameManager.Player.RequestMovementDisable(false);
|
||||
|
||||
_isComplete = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public partial class UpdateCheckPointEvent : EventResource
|
|||
public override void Start(Node2D parent)
|
||||
{
|
||||
_gameManager.LastCheckpointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
||||
_gameManager.Player.LastCheckPointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
||||
// _gameManager.Player.LastCheckPointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
||||
}
|
||||
|
||||
public override void UpdateEvent(double delta)
|
||||
|
|
|
|||
BIN
Sprites/Actors/Focus_Circle.aseprite
(Stored with Git LFS)
BIN
Sprites/Actors/Focus_Circle.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Actors/Focus_Circle.png
(Stored with Git LFS)
BIN
Sprites/Actors/Focus_Circle.png
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Actors/Focus_Circle_Square.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Focus_Circle_Square.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Focus_Circle_Square.png.import
Normal file
34
Sprites/Actors/Focus_Circle_Square.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n68m6gxcl41m"
|
||||
path="res://.godot/imported/Focus_Circle_Square.png-8eda7cd14725156c59a96412942992f8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Focus_Circle_Square.png"
|
||||
dest_files=["res://.godot/imported/Focus_Circle_Square.png-8eda7cd14725156c59a96412942992f8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
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=1
|
||||
BIN
Sprites/Actors/Focus_Square.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Focus_Square.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Focus_Square.png.import
Normal file
34
Sprites/Actors/Focus_Square.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bc4tp44e00g0d"
|
||||
path="res://.godot/imported/Focus_Square.png-b4bb48d5fd73952480ca8cfacec16844.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Focus_Square.png"
|
||||
dest_files=["res://.godot/imported/Focus_Square.png-b4bb48d5fd73952480ca8cfacec16844.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
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=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue