mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:55:35 +00:00
New boss system
This commit is contained in:
parent
0322748d86
commit
c2a72e4e77
14 changed files with 480 additions and 11 deletions
31
Resources/Enemies/Boss_1.tres
Normal file
31
Resources/Enemies/Boss_1.tres
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=6 format=3 uid="uid://ng3lpe8ifbsn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://xhwfgbv0fjbr" path="res://Sprites/Actors/FairyGuard.png" id="1_7gkmq"]
|
||||
[ext_resource type="Script" uid="uid://cq65aed620ijo" path="res://Scripts/Resources/Loot/LootDrop.cs" id="2_3teuq"]
|
||||
[ext_resource type="Resource" uid="uid://b54lru8ulinjl" path="res://Resources/Weapons/EnemyWeapon_Big.tres" id="8_w06jt"]
|
||||
[ext_resource type="Script" uid="uid://cd5o0ceb50jki" path="res://Scripts/Resources/EnemyResource.cs" id="9_vykx5"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n54y5"]
|
||||
atlas = ExtResource("1_7gkmq")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("9_vykx5")
|
||||
EnemyName = &"Boss 1"
|
||||
EnemyKey = &"BOSS_1"
|
||||
PrefabPath = &"uid://dt7i3x3g5ktbl"
|
||||
MaxHealth = 100.0
|
||||
MovementSpeed = 40.0
|
||||
Weapon = ExtResource("8_w06jt")
|
||||
LootDrops = Array[ExtResource("2_3teuq")]([])
|
||||
MotivationReward = 100.0
|
||||
PlayerDetectionRange = 90.0
|
||||
ViewRange = 120.0
|
||||
AlarmReactRange = 150.0
|
||||
PlayerDisengageRange = 500.0
|
||||
StrafeSpeed = 25.0
|
||||
MaxStrafeDistance = 32.0
|
||||
MinStrafeDistance = 16.0
|
||||
ResponseTime = 0.5
|
||||
IconSprite = SubResource("AtlasTexture_n54y5")
|
||||
metadata/_custom_type_script = "uid://cd5o0ceb50jki"
|
||||
276
Scenes/Actors/Roguelite_Boss_1.tscn
Normal file
276
Scenes/Actors/Roguelite_Boss_1.tscn
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
[gd_scene load_steps=46 format=3 uid="uid://dt7i3x3g5ktbl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bi2edpdosngll" path="res://Scripts/Components/FSM/Enemy/EnemyFSMProxy.cs" id="1_krhq1"]
|
||||
[ext_resource type="Resource" uid="uid://ng3lpe8ifbsn" path="res://Resources/Enemies/Boss_1.tres" id="2_u32k8"]
|
||||
[ext_resource type="Script" uid="uid://dn6dbog1s2818" path="res://Scripts/Components/FSM/Enemy/EnemyStateMachine.cs" id="3_0157d"]
|
||||
[ext_resource type="Script" uid="uid://rrelumir3g6n" path="res://Scripts/Components/FSM/Enemy/Init.cs" id="4_q8sxg"]
|
||||
[ext_resource type="Script" uid="uid://cprumccndvblc" path="res://Scripts/Components/FSM/Boss/Idle.cs" id="5_krhq1"]
|
||||
[ext_resource type="Script" uid="uid://dbmc3klko5x18" path="res://Scripts/Components/FSM/Enemy/Alert.cs" id="6_u32k8"]
|
||||
[ext_resource type="Script" uid="uid://difn6d5np1pui" path="res://Scripts/Components/FSM/Boss/Shooting.cs" id="7_u32k8"]
|
||||
[ext_resource type="Script" uid="uid://4hwtlc1ftjsc" path="res://Scripts/Components/FSM/Enemy/Dead.cs" id="8_3n0dy"]
|
||||
[ext_resource type="Resource" uid="uid://bpc2kyft8q2qq" path="res://Resources/Bullets/simple_enemy_bullet_big.tres" id="8_xcri6"]
|
||||
[ext_resource type="Script" uid="uid://b5s5mjuk1rng5" path="res://Scripts/Resources/TimeModifier.cs" id="9_3n0dy"]
|
||||
[ext_resource type="Script" uid="uid://dj37rup1ibnn6" path="res://Scripts/Components/FSM/Enemy/Controlled.cs" id="9_d5ed4"]
|
||||
[ext_resource type="Script" uid="uid://c0ndqalsc4jve" path="res://Scripts/AttackPatterns/SpiralPattern.cs" id="10_d5ed4"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://ch2ll1on8im2p" path="res://Resources/Sprites/FairyGuard.tres" id="10_v2gvi"]
|
||||
[ext_resource type="Script" uid="uid://mb4ugq74a17c" path="res://Scripts/Components/FSM/Enemy/PlayerDetectionModule.cs" id="11_qrag5"]
|
||||
[ext_resource type="Script" uid="uid://cdd6q2h0t1hhq" path="res://Scripts/Resources/BossPhase.cs" id="11_v2gvi"]
|
||||
[ext_resource type="Script" uid="uid://bflvr26h52c55" path="res://Scripts/Components/FSM/Enemy/EnemyStorageModule.cs" id="12_n7vdy"]
|
||||
[ext_resource type="Script" uid="uid://inasa76li3ym" path="res://Scripts/Resources/ScriptableBullets/BossScript.cs" id="12_qrag5"]
|
||||
[ext_resource type="Script" uid="uid://c6467d6yx50qh" path="res://Scripts/Components/BulletSpawner.cs" id="13_3n0dy"]
|
||||
[ext_resource type="Script" uid="uid://cq3hkweplldbr" path="res://Scripts/Components/Actors/GenericDamageReceiver.cs" id="13_uiuc5"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="14_d5ed4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cm564ue740cpx" path="res://Scenes/Actors/DeadFairyGuard.tscn" id="14_k00rh"]
|
||||
[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="15_fumcm"]
|
||||
[ext_resource type="Script" uid="uid://ik7s65de723k" path="res://Scripts/Components/FSM/Enemy/NavigationMovementModule.cs" id="16_v7pqc"]
|
||||
[ext_resource type="PackedScene" uid="uid://cj63k0dmk7tl1" path="res://Scenes/Weapons/enemy_weapon_base.tscn" id="17_o816w"]
|
||||
[ext_resource type="Resource" uid="uid://csdlihliv4cr8" path="res://Resources/Weapons/EnemyWeapon_simple.tres" id="18_jdgrw"]
|
||||
[ext_resource type="Script" uid="uid://dhsqsajq537qn" path="res://Scripts/Components/FSM/Enemy/EnemyAlarmModule.cs" id="19_ka71q"]
|
||||
[ext_resource type="Script" uid="uid://bo5sgbv1t8ril" path="res://Scripts/Components/Actors/PlayerAnimationProvider.cs" id="20_7gxax"]
|
||||
[ext_resource type="Material" uid="uid://dnvwgyt2tbqmr" path="res://Resources/Materials/Player_Blink_Teleport_Material.tres" id="21_udff4"]
|
||||
[ext_resource type="Script" uid="uid://dncdgq843sj2f" path="res://Scripts/Components/FSM/Enemy/AnimationModule.cs" id="22_efp7r"]
|
||||
[ext_resource type="Script" uid="uid://bw4t2clyr6lib" path="res://Scripts/Components/FSM/Enemy/EnemyDropsProvider.cs" id="23_evuap"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2v6j7lsyltrc" path="res://Sprites/Actors/CirnoWings.png" id="24_lf8u1"]
|
||||
[ext_resource type="Script" uid="uid://dq338w2lw5phl" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="25_8rqch"]
|
||||
[ext_resource type="Script" uid="uid://d208gvthkstvc" path="res://Scripts/Components/Actors/PlayerCrosshairProvider.cs" id="26_q2yik"]
|
||||
[ext_resource type="Texture2D" uid="uid://cf2855sd3hqty" path="res://Sprites/Actors/Aiming_Reticule_Small.png" id="27_8kytv"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pnkma"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_n7vdy"]
|
||||
script = ExtResource("10_d5ed4")
|
||||
BulletResource = ExtResource("8_xcri6")
|
||||
bulletCount = 16
|
||||
rotationSpeed = 0.0
|
||||
_rotationOffset = 0.0
|
||||
duration = 5.0
|
||||
spread = 360.0
|
||||
burstInterval = 0.5
|
||||
ShotsPerBurst = 100
|
||||
BurstRate = 0.0
|
||||
_targetPlayer = false
|
||||
OverrideOwner = false
|
||||
Owner = 0
|
||||
OverrideDamageType = false
|
||||
DamageType = 0
|
||||
OverrideControllable = false
|
||||
Controllable = false
|
||||
OverrideCreationModifier = false
|
||||
TimeModifiers = Array[ExtResource("9_3n0dy")]([])
|
||||
WaitForCompletion = true
|
||||
metadata/_custom_type_script = "uid://c0ndqalsc4jve"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uiuc5"]
|
||||
script = ExtResource("11_v2gvi")
|
||||
PhaseName = "Asdf"
|
||||
Threshold = 0
|
||||
PlayAnimation = false
|
||||
Patterns = Array[Object]([SubResource("Resource_n7vdy")])
|
||||
metadata/_custom_type_script = "uid://cdd6q2h0t1hhq"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k00rh"]
|
||||
script = ExtResource("12_qrag5")
|
||||
BossName = &"Test"
|
||||
Phases = [SubResource("Resource_uiuc5")]
|
||||
metadata/_custom_type_script = "uid://inasa76li3ym"
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5wstg"]
|
||||
radius = 29.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6x22m"]
|
||||
radius = 5.0
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_poxpj"]
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 2
|
||||
emission_sphere_radius = 16.0
|
||||
orbit_velocity_min = -1.0
|
||||
orbit_velocity_max = 1.098
|
||||
gravity = Vector3(0, 0, 0)
|
||||
color = Color(0.0392157, 0.380392, 1, 1)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_urwql"]
|
||||
atlas = ExtResource("24_lf8u1")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_wafqr"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_urwql")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_12erk"]
|
||||
atlas = ExtResource("27_8kytv")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_biwfl"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_12erk")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Boss" type="CharacterBody2D" node_paths=PackedStringArray("EnemyFSM")]
|
||||
collision_layer = 16
|
||||
collision_mask = 33
|
||||
script = ExtResource("1_krhq1")
|
||||
EnemyFSM = NodePath("StateMachine")
|
||||
EnemyResource = ExtResource("2_u32k8")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_pnkma")
|
||||
|
||||
[node name="StateMachine" type="Node2D" parent="."]
|
||||
script = ExtResource("3_0157d")
|
||||
|
||||
[node name="Init" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("DamageReceiver", "StorageModule")]
|
||||
script = ExtResource("4_q8sxg")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
|
||||
[node name="Idle" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "DamageReceiver", "_moduleNodes")]
|
||||
script = ExtResource("5_krhq1")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Alert" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "NavigationModule", "_moduleNodes")]
|
||||
script = ExtResource("6_u32k8")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
PlayerDetection = NodePath("../../PlayerDetection")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
NavigationModule = NodePath("../../NavigationModule")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Shooting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("DamageReceiver", "EquippedWeapon", "StorageModule", "_moduleNodes")]
|
||||
script = ExtResource("7_u32k8")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
EquippedWeapon = NodePath("../../EnemyWeapon")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
BossScript = SubResource("Resource_k00rh")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="BulletSpawner" type="Node2D" parent="StateMachine/Shooting"]
|
||||
script = ExtResource("13_3n0dy")
|
||||
BulletScene = ExtResource("14_d5ed4")
|
||||
|
||||
[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "DropsProvider")]
|
||||
script = ExtResource("8_3n0dy")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
DropsProvider = NodePath("../../DropsProvider")
|
||||
|
||||
[node name="Controlled" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "DamageReceiver", "_inputProvider", "CrosshairProvider", "EquippedWeapon", "_moduleNodes")]
|
||||
script = ExtResource("9_d5ed4")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
_inputProvider = NodePath("../../InputProvider")
|
||||
CrosshairProvider = NodePath("../../CrosshairProvider")
|
||||
EquippedWeapon = NodePath("../../EnemyWeapon")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = ExtResource("10_v2gvi")
|
||||
animation = &"right"
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource("11_qrag5")
|
||||
ObstaclesCollisionMask = 81
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
shape = SubResource("CircleShape2D_5wstg")
|
||||
|
||||
[node name="Storage" type="Node2D" parent="." node_paths=PackedStringArray("Root")]
|
||||
script = ExtResource("12_n7vdy")
|
||||
Root = NodePath("..")
|
||||
|
||||
[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("HealthProvider")]
|
||||
collision_layer = 64
|
||||
collision_mask = 136
|
||||
script = ExtResource("13_uiuc5")
|
||||
HealthProvider = NodePath("Health")
|
||||
BulletGroup = 2
|
||||
Debris = ExtResource("14_k00rh")
|
||||
DeleteParentOnDeath = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageReceiver"]
|
||||
position = Vector2(0, 3.865)
|
||||
shape = SubResource("CircleShape2D_6x22m")
|
||||
|
||||
[node name="Health" type="Node2D" parent="DamageReceiver"]
|
||||
script = ExtResource("15_fumcm")
|
||||
ResourceName = "Health"
|
||||
|
||||
[node name="NavigationModule" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule")]
|
||||
script = ExtResource("16_v7pqc")
|
||||
StorageModule = NodePath("../Storage")
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="NavigationModule"]
|
||||
target_desired_distance = 8.0
|
||||
path_max_distance = 800.0
|
||||
path_postprocessing = 1
|
||||
avoidance_enabled = true
|
||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="EnemyWeapon" parent="." instance=ExtResource("17_o816w")]
|
||||
WeaponData = ExtResource("18_jdgrw")
|
||||
|
||||
[node name="AlarmModule" type="Node2D" parent="." node_paths=PackedStringArray("PlayerDetection")]
|
||||
script = ExtResource("19_ka71q")
|
||||
PlayerDetection = NodePath("../PlayerDetection")
|
||||
|
||||
[node name="AnimationProvider" type="Node2D" parent="." node_paths=PackedStringArray("_animatedSprite", "_shieldParticles")]
|
||||
script = ExtResource("20_7gxax")
|
||||
_animatedSprite = NodePath("../AnimatedSprite2D")
|
||||
_shieldParticles = NodePath("ShieldParticles")
|
||||
WalkRightAnimationName = &"right"
|
||||
WalkLeftAnimationName = &"left"
|
||||
WalkDownAnimationName = &"down"
|
||||
WalkUpAnimationName = &"up"
|
||||
BlinkMaterial = ExtResource("21_udff4")
|
||||
|
||||
[node name="ShieldParticles" type="GPUParticles2D" parent="AnimationProvider"]
|
||||
emitting = false
|
||||
amount = 32
|
||||
lifetime = 0.4
|
||||
one_shot = true
|
||||
process_material = SubResource("ParticleProcessMaterial_poxpj")
|
||||
|
||||
[node name="AnimationModule" type="Node2D" parent="." node_paths=PackedStringArray("AnimationProvider", "StorageModule")]
|
||||
script = ExtResource("22_efp7r")
|
||||
AnimationProvider = NodePath("../AnimationProvider")
|
||||
StorageModule = NodePath("../Storage")
|
||||
|
||||
[node name="DropsProvider" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule")]
|
||||
script = ExtResource("23_evuap")
|
||||
StorageModule = NodePath("../Storage")
|
||||
|
||||
[node name="PossessionWings" type="AnimatedSprite2D" parent="."]
|
||||
visible = false
|
||||
sprite_frames = SubResource("SpriteFrames_wafqr")
|
||||
|
||||
[node name="InputProvider" type="Node2D" parent="."]
|
||||
script = ExtResource("25_8rqch")
|
||||
|
||||
[node name="CrosshairProvider" type="Node2D" parent="." node_paths=PackedStringArray("AnimatedSprite")]
|
||||
script = ExtResource("26_q2yik")
|
||||
AnimatedSprite = NodePath("Crosshair")
|
||||
CrosshairDistance = 35.0
|
||||
|
||||
[node name="Crosshair" type="AnimatedSprite2D" parent="CrosshairProvider"]
|
||||
sprite_frames = SubResource("SpriteFrames_biwfl")
|
||||
|
||||
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
|
||||
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]
|
||||
[connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"]
|
||||
[connection signal="velocity_computed" from="NavigationModule/NavigationAgent2D" to="NavigationModule" method="_on_navigation_agent_2d_velocity_computed"]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=11 format=4 uid="uid://24wh7h2dbljf"]
|
||||
[gd_scene load_steps=13 format=4 uid="uid://24wh7h2dbljf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b2j00riayxkit" path="res://Scripts/Controllers/RogueliteRoom.cs" id="1_vhsym"]
|
||||
[ext_resource type="Resource" uid="uid://dn3ai56rrxfnk" path="res://Resources/RogueliteMaps/Beginner1.tres" id="2_vhsym"]
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
[ext_resource type="PackedScene" uid="uid://djf0y08ix66fn" path="res://Scenes/Interactable/Chest.tscn" id="7_kublc"]
|
||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="8_dbn5e"]
|
||||
[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="9_5yebg"]
|
||||
[ext_resource type="PackedScene" uid="uid://dt7i3x3g5ktbl" path="res://Scenes/Actors/Roguelite_Boss_1.tscn" id="10_kublc"]
|
||||
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="11_dbn5e"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_u3c1h"]
|
||||
size = Vector2(272, 85)
|
||||
|
|
@ -51,6 +53,14 @@ position = Vector2(248, 56)
|
|||
position = Vector2(216, 55)
|
||||
LootTable = Array[ExtResource("8_dbn5e")]([ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg")])
|
||||
|
||||
[node name="Boss" parent="Actors" instance=ExtResource("10_kublc")]
|
||||
position = Vector2(217, 106)
|
||||
|
||||
[node name="ControlPad" parent="Actors" node_paths=PackedStringArray("Target") instance=ExtResource("11_dbn5e")]
|
||||
position = Vector2(155, 106)
|
||||
Target = NodePath("../Boss")
|
||||
ActivationType = 1
|
||||
|
||||
[node name="EnemySpawners" type="Node2D" parent="."]
|
||||
|
||||
[node name="PlayerEnterDetector" type="Area2D" parent="."]
|
||||
|
|
|
|||
30
Scripts/Components/FSM/Boss/Idle.cs
Normal file
30
Scripts/Components/FSM/Boss/Idle.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Components.FSM.Enemy;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Boss;
|
||||
|
||||
public partial class Idle : EnemyStateBase
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Idle;
|
||||
|
||||
[Export]
|
||||
public EnemyStorageModule StorageModule { get; private set; }
|
||||
|
||||
[Export]
|
||||
public GenericDamageReceiver DamageReceiver { get; private set; }
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
DamageReceiver.ChangeState(false);
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Scripts/Components/FSM/Boss/Idle.cs.uid
Normal file
1
Scripts/Components/FSM/Boss/Idle.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cprumccndvblc
|
||||
121
Scripts/Components/FSM/Boss/Shooting.cs
Normal file
121
Scripts/Components/FSM/Boss/Shooting.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Components.FSM.Enemy;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.ScriptableBullets;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Boss;
|
||||
|
||||
public partial class Shooting : EnemyStateBase
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Shooting;
|
||||
[Export] public GenericDamageReceiver DamageReceiver { get; private set; }
|
||||
|
||||
[Export] public Weapon EquippedWeapon;
|
||||
|
||||
[Export] public EnemyStorageModule StorageModule { get; private set; }
|
||||
|
||||
[Export] public BossScript BossScript { get; set; }
|
||||
|
||||
// private Marker2D _cameraMarker;
|
||||
//
|
||||
// [Export]
|
||||
// public Vector2 CameraOffset = Vector2.Zero;
|
||||
|
||||
private int _currentPhaseIndex = 0;
|
||||
|
||||
public Vector2 HomePosition => StorageModule.HomePosition;
|
||||
|
||||
private BossPhase CurrentPhase => BossScript.Phases[_currentPhaseIndex];
|
||||
|
||||
private bool _waiting = false;
|
||||
|
||||
public float CurrentHealth => DamageReceiver.HealthProvider.CurrentResource;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
DamageReceiver.ChangeState(true);
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted += HealthProviderOnResourceDepleted;
|
||||
|
||||
StartPhase(CurrentPhase);
|
||||
|
||||
//CallDeferred(MethodName.InitDeferred);
|
||||
}
|
||||
|
||||
private void InitDeferred()
|
||||
{
|
||||
}
|
||||
|
||||
private void GrabCamera()
|
||||
{
|
||||
}
|
||||
|
||||
private void HealthProviderOnResourceDepleted()
|
||||
{
|
||||
ChangeState(EnemyState.Dead);
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted -= HealthProviderOnResourceDepleted;
|
||||
|
||||
DamageReceiver.ChangeState(false);
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
base.PhysicsProcessState(delta);
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
|
||||
if (_waiting) return;
|
||||
CurrentPhase.UpdatePhase(delta);
|
||||
|
||||
if (CurrentHealth <= CurrentPhase.Threshold && _currentPhaseIndex + 1 < BossScript.Phases.Count)
|
||||
{
|
||||
_currentPhaseIndex++;
|
||||
//_bossHud.SpellCardName = CurrentPhase.PhaseName;
|
||||
StartPhase(CurrentPhase);
|
||||
}
|
||||
}
|
||||
|
||||
private void StartPhase(BossPhase phase)
|
||||
{
|
||||
GameManager.Instance.ClearBullets();
|
||||
if (phase.PlayAnimation)
|
||||
{
|
||||
_waiting = true;
|
||||
|
||||
DamageReceiver.ChangeState(false);
|
||||
_ = Switchphase(phase);
|
||||
}
|
||||
else
|
||||
{
|
||||
phase.Start(this);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Switchphase(BossPhase phase)
|
||||
{
|
||||
await PlayAnimation();
|
||||
|
||||
_waiting = false;
|
||||
DamageReceiver.ChangeState(true);
|
||||
phase.Start(this);
|
||||
}
|
||||
|
||||
private async Task PlayAnimation()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Boss/Shooting.cs.uid
Normal file
1
Scripts/Components/FSM/Boss/Shooting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://difn6d5np1pui
|
||||
|
|
@ -46,8 +46,10 @@ public partial class EnemyFSMProxy : CharacterBody2D, IActivable
|
|||
break;
|
||||
case ActivationType.Enable:
|
||||
// Enable or disable AI
|
||||
EnemyFSM.SetState(EnemyState.Shooting);
|
||||
break;
|
||||
case ActivationType.Disable:
|
||||
EnemyFSM.SetState(EnemyState.Idle);
|
||||
// Enable or disable AI
|
||||
break;
|
||||
case ActivationType.Use:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public partial class EnemyStorageModule : Node2D, IFSMStorage
|
|||
|
||||
public EnemyResource EnemyData => Root.EnemyResource;
|
||||
|
||||
public Vector2 HomePosition { get; set; }
|
||||
|
||||
public Vector2 MovementDirection { get; set; }
|
||||
public Vector2 FacingDirection { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ public partial class Idle : EnemyStateBase
|
|||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
GD.Print("Entered Idle");
|
||||
PlayerDetection.SetRange(StorageModule.Root.EnemyResource.PlayerDetectionRange);
|
||||
|
||||
_isPlayerInRange = PlayerDetection.IsPlayerInRange(StorageModule.Root.EnemyResource.ViewRange);
|
||||
|
|
@ -59,13 +58,12 @@ public partial class Idle : EnemyStateBase
|
|||
private void PlayerDetectionOnPlayerOutOfRange()
|
||||
{
|
||||
_isPlayerInRange = false;
|
||||
GD.Print("Player out of range");
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
GD.Print("Exited Idle");
|
||||
|
||||
PlayerDetection.PlayerInRange -= PlayerDetectionOnPlayerInRange;
|
||||
|
||||
PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ public partial class Init : EnemyStateBase
|
|||
|
||||
public override void EnterState()
|
||||
{
|
||||
GD.Print("Enemy init");
|
||||
DamageReceiver.HealthProvider.MaxResource = StorageModule.Root.EnemyResource.MaxHealth;
|
||||
|
||||
StorageModule.AiState = StorageModule.Root.StartingAiState;
|
||||
|
||||
|
||||
StorageModule.HomePosition = MainObject.GlobalPosition;
|
||||
// TODO: Hide wings
|
||||
// TODO: Hide aiming reticule
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ public partial class Shooting : EnemyStateBase
|
|||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
GD.Print($"Entered {Name}");
|
||||
|
||||
//_isPlayerInRange = PlayerDetection.IsPlayerInRange(StorageModule.Root.EnemyResource.ViewRange);
|
||||
|
||||
PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
|
|
@ -66,7 +63,6 @@ public partial class Shooting : EnemyStateBase
|
|||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
GD.Print($"Exited {Name}");
|
||||
|
||||
PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public partial class BossPhase : Resource
|
|||
|
||||
private IPatternMachine _patternMachine;
|
||||
|
||||
public void Start(Boss boss)
|
||||
public void Start(Node2D boss)
|
||||
{
|
||||
currentPatternIndex = 0;
|
||||
_patternMachine = Patterns[currentPatternIndex].MakeMachine(boss);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public partial class RogueliteMapTheme : Resource
|
|||
[Export] public PackedScene HorizontalSouthWallPrefab { get; set; }
|
||||
[Export] public PackedScene VerticalDoorPrefab { get; set; }
|
||||
[Export] public PackedScene VerticalWallPrefab { get; set; }
|
||||
[Export] public PackedScene VerticalSecretDoorPrefab { get; set; }
|
||||
[Export] public PackedScene DoorLockPrefab { get; set; }
|
||||
[Export] public PackedScene KeyCardPrefab { get; set; }
|
||||
[Export] public PackedScene ChestPrefab { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue