mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 19:15:55 +00:00
3D Boss scripts implementation
This commit is contained in:
parent
b0d0161ab0
commit
dbf7f1a963
29 changed files with 1805 additions and 1188 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
|
|
@ -35,7 +35,7 @@ script = ExtResource("6_w4wji")
|
|||
AlarmSound = ExtResource("7_5vm3d")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.442606, -0.744379, 0.5, 0.287606, 0.645974, 0.707107, -0.849343, -0.169166, 0.5, 30.2584, 5.82742, 20.7297)
|
||||
transform = Transform3D(0.442606, -0.744379, 0.5, 0.287606, 0.645974, 0.707107, -0.849343, -0.169167, 0.5, 30.2584, 5.82742, 20.7297)
|
||||
light_energy = 1.375
|
||||
light_bake_mode = 1
|
||||
shadow_enabled = true
|
||||
|
|
@ -44,7 +44,7 @@ shadow_enabled = true
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.84862, 0, -4.8932)
|
||||
|
||||
[node name="StartPosition" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 82.037, 1.57535, -32.2886)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 112.949, -1.17626, -35.1522)
|
||||
|
||||
[node name="CameraTarget" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.0389, 2.33215, 3.16925)
|
||||
|
|
|
|||
72
Resources/BossPhases/Rumia_Boss_Script_3D.tres
Normal file
72
Resources/BossPhases/Rumia_Boss_Script_3D.tres
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
[gd_resource type="Resource" script_class="BossScript" load_steps=13 format=3 uid="uid://1u4y6hvc318e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cdd6q2h0t1hhq" path="res://Scripts/Resources/BossPhase.cs" id="1_k3wbt"]
|
||||
[ext_resource type="Script" uid="uid://fo8sf11p058s" path="res://Scripts/Resources/BulletScripts/SimpleMovementPattern3D.cs" id="2_mi6hp"]
|
||||
[ext_resource type="Script" uid="uid://inasa76li3ym" path="res://Scripts/Resources/ScriptableBullets/BossScript.cs" id="2_t8f0y"]
|
||||
[ext_resource type="Script" uid="uid://b5s5mjuk1rng5" path="res://Scripts/Resources/TimeModifier.cs" id="3_mi6hp"]
|
||||
[ext_resource type="Resource" uid="uid://dl3nq7odtrnum" path="res://Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet_3D.tres" id="3_xfnue"]
|
||||
[ext_resource type="Script" uid="uid://bxiprx5nwmpnu" path="res://Scripts/AttackPatterns/ShootingPattern3D.cs" id="4_xfnue"]
|
||||
[ext_resource type="Script" uid="uid://cg7gi3tva4gvw" path="res://Scripts/AttackPatterns/WaitPattern.cs" id="6_xfnue"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xfnue"]
|
||||
script = ExtResource("2_mi6hp")
|
||||
relativeTargetPosition = Vector2(-1, 0)
|
||||
moveDuration = 1.0
|
||||
transitionType = 0
|
||||
easeType = 2
|
||||
WaitForCompletion = false
|
||||
metadata/_custom_type_script = "uid://fo8sf11p058s"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_231tu"]
|
||||
script = ExtResource("4_xfnue")
|
||||
BulletResource = ExtResource("3_xfnue")
|
||||
EmitterOffset = Vector3(0, 0, 0)
|
||||
bulletCount = 10
|
||||
rotationSpeed = 0.0
|
||||
_rotationOffset = 0.0
|
||||
duration = 2.0
|
||||
spread = 0.0
|
||||
burstInterval = 0.3
|
||||
ShotsPerBurst = 100
|
||||
BurstRate = 0.0
|
||||
_targetPlayer = true
|
||||
_predictPlayer = false
|
||||
OverrideOwner = false
|
||||
Owner = 0
|
||||
OverrideDamageType = false
|
||||
DamageType = 0
|
||||
OverrideControllable = false
|
||||
Controllable = false
|
||||
OverrideCreationModifier = false
|
||||
TimeModifiers = Array[ExtResource("3_mi6hp")]([])
|
||||
WaitForCompletion = true
|
||||
metadata/_custom_type_script = "uid://bxiprx5nwmpnu"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lrsat"]
|
||||
script = ExtResource("2_mi6hp")
|
||||
relativeTargetPosition = Vector2(0, 0)
|
||||
moveDuration = 1.0
|
||||
transitionType = 0
|
||||
easeType = 2
|
||||
WaitForCompletion = true
|
||||
metadata/_custom_type_script = "uid://fo8sf11p058s"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0t311"]
|
||||
script = ExtResource("6_xfnue")
|
||||
SecondsToWait = 10.0
|
||||
WaitForCompletion = true
|
||||
metadata/_custom_type_script = "uid://cg7gi3tva4gvw"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_l0s11"]
|
||||
script = ExtResource("1_k3wbt")
|
||||
PhaseName = ""
|
||||
Threshold = 0
|
||||
PlayAnimation = false
|
||||
Patterns = Array[Object]([SubResource("Resource_xfnue"), SubResource("Resource_231tu"), SubResource("Resource_lrsat"), SubResource("Resource_0t311")])
|
||||
metadata/_custom_type_script = "uid://cdd6q2h0t1hhq"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_t8f0y")
|
||||
BossName = &"Rumia"
|
||||
Phases = Array[ExtResource("1_k3wbt")]([SubResource("Resource_l0s11")])
|
||||
metadata/_custom_type_script = "uid://inasa76li3ym"
|
||||
38
Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet_3D.tres
Normal file
38
Resources/Bullets/Boss/Rumia/Rumia_Red_Chase_Bullet_3D.tres
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[gd_resource type="Resource" script_class="BulletResource" load_steps=7 format=3 uid="uid://dl3nq7odtrnum"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d28e1t2c0lwbp" path="res://Scenes/Weapons/base_enemy_bullet_3D.tscn" id="1_2ooja"]
|
||||
[ext_resource type="Script" uid="uid://b6h8slfcd5suh" path="res://Scripts/Resources/DecreasingSpeedModifier.cs" id="2_hgq8i"]
|
||||
[ext_resource type="Script" uid="uid://c6kkaq6j4thug" path="res://Scripts/Resources/Modifiers/DelayedPlayerFacingModifier.cs" id="3_eppnc"]
|
||||
[ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="4_2o0fq"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_jeq72"]
|
||||
script = ExtResource("2_hgq8i")
|
||||
decreaseRate = 0.2
|
||||
|
||||
[sub_resource type="Resource" id="Resource_edsop"]
|
||||
script = ExtResource("3_eppnc")
|
||||
TimeInSeconds = 0.0
|
||||
ModifierType = 2
|
||||
Value = 0.0
|
||||
Continuous = false
|
||||
|
||||
[resource]
|
||||
script = ExtResource("4_2o0fq")
|
||||
BulletScene = ExtResource("1_2ooja")
|
||||
BulletSpeed = 4.0
|
||||
Direction = Vector2(1, 0)
|
||||
BulletDamage = 20.0
|
||||
MaxDamage = 1.0
|
||||
Knockback = 1.0
|
||||
LifeTime = 20.0
|
||||
DestroyOnCollision = true
|
||||
Owner = 2
|
||||
DamageType = 0
|
||||
RotateSprite = false
|
||||
Controllable = false
|
||||
Freezable = true
|
||||
Grazeable = true
|
||||
GrazeValue = 0.2
|
||||
Attributes = 34
|
||||
Modifier = SubResource("Resource_jeq72")
|
||||
TimeModifiers = Array[Object]([SubResource("Resource_edsop")])
|
||||
71
Resources/Enemies/Rumia_3D.tres
Normal file
71
Resources/Enemies/Rumia_3D.tres
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
[gd_resource type="Resource" script_class="EnemyResource" load_steps=18 format=3 uid="uid://bmgnelk21apt6"]
|
||||
|
||||
[ext_resource type="SpriteFrames" uid="uid://ch2ll1on8im2p" path="res://Resources/Sprites/FairyGuard.tres" id="1_jhiim"]
|
||||
[ext_resource type="Resource" uid="uid://1u4y6hvc318e" path="res://Resources/BossPhases/Rumia_Boss_Script_3D.tres" id="2_2p3bo"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbdrws471xslc" path="res://Sprites/Actors/Rumia-world.png" id="2_jhiim"]
|
||||
[ext_resource type="Script" uid="uid://cq65aed620ijo" path="res://Scripts/Resources/Loot/LootDrop.cs" id="3_lo74v"]
|
||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="4_n525f"]
|
||||
[ext_resource type="Resource" uid="uid://dy53gia1tmkah" path="res://Resources/Items/Points_Pickup.tres" id="5_k51wg"]
|
||||
[ext_resource type="Resource" uid="uid://bhbufxodybsw4" path="res://Resources/Items/Shield_Pickup.tres" id="6_707vn"]
|
||||
[ext_resource type="Resource" uid="uid://dodwpect0ldjf" path="res://Resources/Items/Heart_Pickup.tres" id="7_8myk5"]
|
||||
[ext_resource type="Resource" uid="uid://clr1gln7nxa1o" path="res://Resources/Items/Power_Pickup.tres" id="8_cytb0"]
|
||||
[ext_resource type="Resource" uid="uid://c6ywv08e6is5o" path="res://Resources/Weapons/EnemyWeapon_Big_3D.tres" id="9_80fxw"]
|
||||
[ext_resource type="Script" uid="uid://cd5o0ceb50jki" path="res://Scripts/Resources/EnemyResource.cs" id="10_wrko3"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n54y5"]
|
||||
atlas = ExtResource("2_jhiim")
|
||||
region = Rect2(0, 0, 8, 16)
|
||||
|
||||
[sub_resource type="Resource" id="Resource_c8nix"]
|
||||
script = ExtResource("3_lo74v")
|
||||
Item = ExtResource("4_n525f")
|
||||
Chance = 40.0
|
||||
metadata/_custom_type_script = "uid://cq65aed620ijo"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gs2l3"]
|
||||
script = ExtResource("3_lo74v")
|
||||
Item = ExtResource("5_k51wg")
|
||||
Chance = 10.0
|
||||
metadata/_custom_type_script = "uid://cq65aed620ijo"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_sqnvg"]
|
||||
script = ExtResource("3_lo74v")
|
||||
Item = ExtResource("6_707vn")
|
||||
Chance = 5.0
|
||||
metadata/_custom_type_script = "uid://cq65aed620ijo"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5tyar"]
|
||||
script = ExtResource("3_lo74v")
|
||||
Item = ExtResource("7_8myk5")
|
||||
Chance = 5.0
|
||||
metadata/_custom_type_script = "uid://cq65aed620ijo"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_48xq6"]
|
||||
script = ExtResource("3_lo74v")
|
||||
Item = ExtResource("8_cytb0")
|
||||
Chance = 6.0
|
||||
metadata/_custom_type_script = "uid://cq65aed620ijo"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("10_wrko3")
|
||||
EnemyName = &"Rumia"
|
||||
EnemyKey = &"RUMIA"
|
||||
PrefabPath = &"uid://cboj3aamnco2r"
|
||||
MaxHealth = 900.0
|
||||
MovementSpeed = 2.0
|
||||
Weapon = ExtResource("9_80fxw")
|
||||
LootDrops = Array[ExtResource("3_lo74v")]([SubResource("Resource_c8nix"), SubResource("Resource_gs2l3"), SubResource("Resource_sqnvg"), SubResource("Resource_5tyar"), SubResource("Resource_48xq6")])
|
||||
MotivationReward = 4.0
|
||||
PredictPlayer = false
|
||||
PlayerDetectionRange = 4.0
|
||||
ViewRange = 5.0
|
||||
AlarmReactRange = 8.0
|
||||
PlayerDisengageRange = 10.0
|
||||
StrafeSpeed = 1.5
|
||||
MaxStrafeDistance = 1.0
|
||||
MinStrafeDistance = 0.2
|
||||
ResponseTime = 0.5
|
||||
IconSprite = SubResource("AtlasTexture_n54y5")
|
||||
AnimationFrames = ExtResource("1_jhiim")
|
||||
BossScript = ExtResource("2_2p3bo")
|
||||
metadata/_custom_type_script = "uid://cd5o0ceb50jki"
|
||||
213
Scenes/Actors/Generic_Boss_3D.tscn
Normal file
213
Scenes/Actors/Generic_Boss_3D.tscn
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
[gd_scene load_steps=35 format=3 uid="uid://cboj3aamnco2r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwregubt4iila" path="res://Scripts/Components/FSM/Enemy/3D/EnemyProxy3D.cs" id="1_1rch2"]
|
||||
[ext_resource type="Resource" uid="uid://bmgnelk21apt6" path="res://Resources/Enemies/Rumia_3D.tres" id="2_nghfy"]
|
||||
[ext_resource type="Script" uid="uid://c651imhj6rjsh" path="res://Scripts/Components/FSM/Enemy/3D/EnemyStateMachine3D.cs" id="3_nghfy"]
|
||||
[ext_resource type="Script" uid="uid://cy34e3htvbvnl" path="res://Scripts/Components/FSM/Enemy/3D/Init.cs" id="4_ypm0v"]
|
||||
[ext_resource type="Script" uid="uid://05agh8h015fy" path="res://Scripts/Components/FSM/Boss/3D/Idle.cs" id="5_1rch2"]
|
||||
[ext_resource type="Script" uid="uid://dvtdw2hcp4rm2" path="res://Scripts/Components/FSM/Enemy/3D/Alert.cs" id="6_meamr"]
|
||||
[ext_resource type="Script" uid="uid://d2838a10x33w8" path="res://Scripts/Components/FSM/Boss/3D/Shooting.cs" id="7_ndwwt"]
|
||||
[ext_resource type="Script" uid="uid://3irm5sccr2fc" path="res://Scripts/Components/FSM/Enemy/3D/Dead.cs" id="8_t5xh8"]
|
||||
[ext_resource type="Script" uid="uid://mpws3eyrmx0q" path="res://Scripts/Components/FSM/Enemy/3D/Controlled.cs" id="9_yw116"]
|
||||
[ext_resource type="Script" uid="uid://ts64slgd7twt" path="res://Scripts/Components/FSM/Enemy/3D/EnemyAnimationModule3D.cs" id="10_qde1g"]
|
||||
[ext_resource type="Script" uid="uid://cq1joxgoj3jdp" path="res://Scripts/Components/Actors/3D/PlayerAnimationProvider3D.cs" id="11_xacal"]
|
||||
[ext_resource type="Material" uid="uid://dsrsfpcpwmaql" path="res://Resources/Materials/Player_Blink_Teleport_Material_3D.tres" id="12_bpw1r"]
|
||||
[ext_resource type="Shader" uid="uid://b8up3g1w7uqey" path="res://Shaders/Blink_3D.gdshader" id="13_rvc4r"]
|
||||
[ext_resource type="Texture2D" uid="uid://xhwfgbv0fjbr" path="res://Sprites/Actors/FairyGuard.png" id="14_t5838"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://ch2ll1on8im2p" path="res://Resources/Sprites/FairyGuard.tres" id="15_fkdnv"]
|
||||
[ext_resource type="Script" uid="uid://de31afbiua8xu" path="res://Scripts/Components/FSM/Enemy/3D/EnemyFSMAnimatedSprite3D.cs" id="16_hi83g"]
|
||||
[ext_resource type="Script" uid="uid://chq5a73kw0c0m" path="res://Scripts/Components/FSM/Enemy/3D/EnemyStorage3D.cs" id="17_v4sds"]
|
||||
[ext_resource type="Script" uid="uid://extjdng8nk6r" path="res://Scripts/Components/FSM/Enemy/3D/PlayerDetection3D.cs" id="18_spmi6"]
|
||||
[ext_resource type="Script" uid="uid://k5k8wf821ytg" path="res://Scripts/Components/FSM/Enemy/3D/NavigationProvider3D.cs" id="19_e4lgb"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfgc6ik8vb08c" path="res://Scenes/Weapons/BaseWeapon_3D.tscn" id="20_lvcyx"]
|
||||
[ext_resource type="Script" uid="uid://bvcfa6wivpgy1" path="res://Scripts/Components/FSM/Enemy/3D/EnemyDamageModule3D.cs" id="21_eoj2v"]
|
||||
[ext_resource type="Script" uid="uid://dmawekjfas6k8" path="res://Scripts/Components/Actors/DamageReceiver3D.cs" id="22_85wnj"]
|
||||
[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="23_dggrs"]
|
||||
[ext_resource type="Script" uid="uid://dvln1783wvvuw" path="res://Scripts/Components/Actors/ShadowProvider.cs" id="24_nxupd"]
|
||||
[ext_resource type="Script" uid="uid://qrdor3gk6x37" path="res://Scripts/Components/FSM/Enemy/3D/GravityProvider.cs" id="25_mdc23"]
|
||||
[ext_resource type="Script" uid="uid://dej2tbl70yiyp" path="res://Scripts/Components/FSM/Boss/3D/BossScriptHostModule3D.cs" id="26_nghfy"]
|
||||
[ext_resource type="Script" uid="uid://bf5f2phitdqw8" path="res://Scripts/Actors/BulletSpawner3D.cs" id="26_ypm0v"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jgarc"]
|
||||
radius = 0.343
|
||||
height = 0.686
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ad5n8"]
|
||||
atlas = ExtResource("14_t5838")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_d6h7c"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 0
|
||||
shader = ExtResource("13_rvc4r")
|
||||
shader_parameter/tex = SubResource("AtlasTexture_ad5n8")
|
||||
shader_parameter/blink_color = Color(0.954799, 0.00675169, 0, 1)
|
||||
shader_parameter/blink_intensity = 0.0
|
||||
shader_parameter/teleport_progress = 0.0
|
||||
shader_parameter/scanline_density = 0.0
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_5j04l"]
|
||||
height = 1.91858
|
||||
radius = 3.04834
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_uv2lf"]
|
||||
height = 0.853027
|
||||
radius = 0.426758
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cc7e7"]
|
||||
transparency = 1
|
||||
depth_draw_mode = 2
|
||||
shading_mode = 0
|
||||
albedo_color = Color(0, 0, 0, 0.235294)
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_05pdu"]
|
||||
material = SubResource("StandardMaterial3D_cc7e7")
|
||||
|
||||
[node name="Boss" type="CharacterBody3D" node_paths=PackedStringArray("EnemyFSM")]
|
||||
collision_layer = 64
|
||||
collision_mask = 17
|
||||
script = ExtResource("1_1rch2")
|
||||
EnemyFSM = NodePath("StateMachine")
|
||||
EnemyResource = ExtResource("2_nghfy")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.047, 0)
|
||||
shape = SubResource("CapsuleShape3D_jgarc")
|
||||
|
||||
[node name="StateMachine" type="Node" parent="."]
|
||||
script = ExtResource("3_nghfy")
|
||||
|
||||
[node name="Init" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage", "DetectionProvider", "_moduleNodes")]
|
||||
script = ExtResource("4_ypm0v")
|
||||
Storage = NodePath("../../Storage")
|
||||
DetectionProvider = NodePath("../../PlayerDetectionProvider")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage", "GravityProvider", "_moduleNodes")]
|
||||
script = ExtResource("5_1rch2")
|
||||
Storage = NodePath("../../Storage")
|
||||
GravityProvider = NodePath("../../GravityProvider")
|
||||
DebugEnabled = true
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Alert" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage", "PlayerDetection", "NavigationModule", "GravityProvider", "_moduleNodes")]
|
||||
script = ExtResource("6_meamr")
|
||||
Storage = NodePath("../../Storage")
|
||||
PlayerDetection = NodePath("../../PlayerDetectionProvider")
|
||||
NavigationModule = NodePath("../../NavigationProvider")
|
||||
GravityProvider = NodePath("../../GravityProvider")
|
||||
DebugEnabled = true
|
||||
_moduleNodes = [NodePath("../../DamageModule"), NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Shooting" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage", "GravityProvider", "_moduleNodes")]
|
||||
script = ExtResource("7_ndwwt")
|
||||
Storage = NodePath("../../Storage")
|
||||
GravityProvider = NodePath("../../GravityProvider")
|
||||
_moduleNodes = [NodePath("../../DamageModule"), NodePath("../../AnimationModule"), NodePath("../../BossScriptModule")]
|
||||
|
||||
[node name="Dead" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage")]
|
||||
script = ExtResource("8_t5xh8")
|
||||
Storage = NodePath("../../Storage")
|
||||
|
||||
[node name="Controlled" type="Node" parent="StateMachine" node_paths=PackedStringArray("Storage", "_moduleNodes")]
|
||||
script = ExtResource("9_yw116")
|
||||
Storage = NodePath("../../Storage")
|
||||
_moduleNodes = [NodePath("../../DamageModule")]
|
||||
|
||||
[node name="AnimationModule" type="Node" parent="." node_paths=PackedStringArray("AnimationProvider", "Storage", "HealthProvider")]
|
||||
script = ExtResource("10_qde1g")
|
||||
AnimationProvider = NodePath("../AnimationProvider")
|
||||
Storage = NodePath("../Storage")
|
||||
HealthProvider = NodePath("../DamageReceiver/HealthProvider")
|
||||
|
||||
[node name="AnimationProvider" type="Node3D" parent="." node_paths=PackedStringArray("AnimatedSprite")]
|
||||
script = ExtResource("11_xacal")
|
||||
AnimatedSprite = NodePath("../AnimatedSprite3D")
|
||||
WalkRightAnimationName = &"right"
|
||||
WalkLeftAnimationName = &"left"
|
||||
WalkDownAnimationName = &"down"
|
||||
WalkUpAnimationName = &"up"
|
||||
BlinkMaterial = ExtResource("12_bpw1r")
|
||||
|
||||
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."]
|
||||
transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 0, 0)
|
||||
material_override = SubResource("ShaderMaterial_d6h7c")
|
||||
pixel_size = 0.05
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
sprite_frames = ExtResource("15_fkdnv")
|
||||
animation = &"down"
|
||||
frame = 2
|
||||
frame_progress = 0.92087
|
||||
script = ExtResource("16_hi83g")
|
||||
|
||||
[node name="Storage" type="Node" parent="." node_paths=PackedStringArray("Root")]
|
||||
script = ExtResource("17_v4sds")
|
||||
Root = NodePath("..")
|
||||
|
||||
[node name="PlayerDetectionProvider" type="Area3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource("18_spmi6")
|
||||
ObstaclesCollisionMask = 17
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerDetectionProvider"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.557434, 0)
|
||||
shape = SubResource("CylinderShape3D_5j04l")
|
||||
|
||||
[node name="NavigationProvider" type="Node" parent="." node_paths=PackedStringArray("NavigationAgent", "StorageModule")]
|
||||
script = ExtResource("19_e4lgb")
|
||||
NavigationAgent = NodePath("../NavigationAgent3D")
|
||||
StorageModule = NodePath("../Storage")
|
||||
|
||||
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
|
||||
path_postprocessing = 1
|
||||
debug_enabled = true
|
||||
|
||||
[node name="Weapon" parent="." instance=ExtResource("20_lvcyx")]
|
||||
|
||||
[node name="DamageModule" type="Node" parent="." node_paths=PackedStringArray("DamageReceiver", "StorageModule", "AnimationProvider")]
|
||||
script = ExtResource("21_eoj2v")
|
||||
DamageReceiver = NodePath("../DamageReceiver")
|
||||
StorageModule = NodePath("../Storage")
|
||||
AnimationProvider = NodePath("../AnimationProvider")
|
||||
|
||||
[node name="DamageReceiver" type="Area3D" parent="." node_paths=PackedStringArray("HealthProvider")]
|
||||
collision_layer = 64
|
||||
collision_mask = 8
|
||||
script = ExtResource("22_85wnj")
|
||||
HealthProvider = NodePath("HealthProvider")
|
||||
BulletGroup = 2
|
||||
DeleteParentOnDeath = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="DamageReceiver"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00463867, 0)
|
||||
shape = SubResource("CylinderShape3D_uv2lf")
|
||||
|
||||
[node name="HealthProvider" type="Node" parent="DamageReceiver"]
|
||||
script = ExtResource("23_dggrs")
|
||||
ResourceName = "Health"
|
||||
|
||||
[node name="Shadow" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -0.29, 0)
|
||||
mesh = SubResource("QuadMesh_05pdu")
|
||||
script = ExtResource("24_nxupd")
|
||||
CollisionMask = 1
|
||||
|
||||
[node name="GravityProvider" type="Node" parent="."]
|
||||
script = ExtResource("25_mdc23")
|
||||
Gravity = -20.0
|
||||
MaxFallSpeed = 50.0
|
||||
|
||||
[node name="BossScriptModule" type="Node3D" parent="." node_paths=PackedStringArray("StorageModule", "DamageReceiver")]
|
||||
script = ExtResource("26_nghfy")
|
||||
StorageModule = NodePath("../Storage")
|
||||
DamageReceiver = NodePath("../DamageReceiver")
|
||||
|
||||
[node name="BulletSpawner3D" type="Node3D" parent="BossScriptModule"]
|
||||
script = ExtResource("26_ypm0v")
|
||||
|
||||
[connection signal="body_entered" from="PlayerDetectionProvider" to="PlayerDetectionProvider" method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="PlayerDetectionProvider" to="PlayerDetectionProvider" method="_on_body_exited"]
|
||||
[connection signal="velocity_computed" from="NavigationAgent3D" to="NavigationProvider" method="_on_navigation_agent_3d_velocity_computed"]
|
||||
[connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"]
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://cfldr7l7dearo" path="res://Sprites/Bullets/mid_bullet_red.png" id="2_xnqcl"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"]
|
||||
radius = 0.172059
|
||||
radius = 0.161126
|
||||
|
||||
[node name="Bullet" type="Area3D" groups=["bullets"]]
|
||||
collision_layer = 128
|
||||
|
|
@ -14,8 +14,8 @@ Speed = 200.0
|
|||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 0, 0)
|
||||
pixel_size = 0.05
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("2_xnqcl")
|
||||
|
||||
|
|
|
|||
47
Scripts/AttackPatterns/WaitPattern.cs
Normal file
47
Scripts/AttackPatterns/WaitPattern.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.AttackPatterns;
|
||||
|
||||
[GlobalClass]
|
||||
[Tool]
|
||||
public partial class WaitPattern : AttackPattern
|
||||
{
|
||||
[Export] public float SecondsToWait = 1f;
|
||||
|
||||
public override IPatternMachine MakeMachine(Node parent)
|
||||
{
|
||||
return new WaitPatternMachine(this, parent);
|
||||
}
|
||||
|
||||
public class WaitPatternMachine(WaitPattern pattern, Node parent) : IPatternMachine
|
||||
{
|
||||
public Node Parent => parent;
|
||||
private bool _isComplete = false;
|
||||
protected IScriptHost3D Boss;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_isComplete = false;
|
||||
_ = WaitAsync(pattern.SecondsToWait);
|
||||
}
|
||||
|
||||
public void UpdatePattern(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async Task WaitAsync(float time)
|
||||
{
|
||||
await Task.Delay((int)time * 1000);
|
||||
|
||||
_isComplete = true;
|
||||
}
|
||||
|
||||
public bool IsComplete()
|
||||
{
|
||||
return _isComplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/AttackPatterns/WaitPattern.cs.uid
Normal file
1
Scripts/AttackPatterns/WaitPattern.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cg7gi3tva4gvw
|
||||
14
Scripts/Components/Actors/3D/BulletSprite3D.cs
Normal file
14
Scripts/Components/Actors/3D/BulletSprite3D.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors._3D;
|
||||
|
||||
public partial class BulletSprite3D : Sprite3D
|
||||
{
|
||||
private Bullet3D _parent;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_parent = GetParent<Bullet3D>();
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/Actors/3D/BulletSprite3D.cs.uid
Normal file
1
Scripts/Components/Actors/3D/BulletSprite3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c4j8jwgs6okew
|
||||
117
Scripts/Components/FSM/Boss/3D/BossScriptHostModule3D.cs
Normal file
117
Scripts/Components/FSM/Boss/3D/BossScriptHostModule3D.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.AttackPatterns;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
using Cirno.Scripts.Controllers;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.ScriptableBullets;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Boss._3D;
|
||||
|
||||
public partial class BossScriptHostModule3D : ModuleBase<EnemyState, CharacterBody3D>, IScriptHost3D
|
||||
{
|
||||
[Export] public BossScript BossScript { get; set; }
|
||||
|
||||
[Export]
|
||||
public EnemyStorage3D StorageModule { get; private set; }
|
||||
|
||||
[Export] public DamageReceiver3D DamageReceiver { get; private set; }
|
||||
|
||||
public Node3D ParentObject => _machine.MainObject;
|
||||
public Vector3 HomePosition => StorageModule.HomePosition;
|
||||
|
||||
private IStateMachine<EnemyState, CharacterBody3D> _machine;
|
||||
|
||||
private int _currentPhaseIndex = 0;
|
||||
private BossPhase CurrentPhase => BossScript.Phases[_currentPhaseIndex];
|
||||
private bool _waiting = false;
|
||||
public float CurrentHealth => DamageReceiver.HealthProvider.CurrentResource;
|
||||
|
||||
|
||||
|
||||
public void ChangeSpriteDirection(Vector2 direction)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void EnterState(EnemyState state)
|
||||
{
|
||||
DamageReceiver.ChangeState(true);
|
||||
DamageReceiver.HealthProvider.ResourceDepleted += HealthProviderOnResourceDepleted;
|
||||
|
||||
StartPhase(CurrentPhase);
|
||||
}
|
||||
|
||||
public override void ExitState(EnemyState state)
|
||||
{
|
||||
DamageReceiver.HealthProvider.ResourceDepleted -= HealthProviderOnResourceDepleted;
|
||||
|
||||
DamageReceiver.ChangeState(false);
|
||||
}
|
||||
|
||||
public override void Init(IStateMachine<EnemyState, CharacterBody3D> machine)
|
||||
{
|
||||
_machine = machine;
|
||||
|
||||
if (StorageModule.Root.EnemyResource.BossScript is not null)
|
||||
{
|
||||
this.BossScript = StorageModule.Root.EnemyResource.BossScript;
|
||||
}
|
||||
}
|
||||
|
||||
private void HealthProviderOnResourceDepleted()
|
||||
{
|
||||
_machine.SetState(EnemyState.Dead);
|
||||
}
|
||||
|
||||
public override void Process(double delta)
|
||||
{
|
||||
if (_waiting) return;
|
||||
CurrentPhase.UpdatePhase(delta);
|
||||
|
||||
if (CurrentHealth <= CurrentPhase.Threshold && _currentPhaseIndex + 1 < BossScript.Phases.Count)
|
||||
{
|
||||
_currentPhaseIndex++;
|
||||
//_bossHud.SpellCardName = CurrentPhase.PhaseName;
|
||||
StartPhase(CurrentPhase);
|
||||
}
|
||||
}
|
||||
|
||||
public override void PhysicsProcess(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void StartPhase(BossPhase phase)
|
||||
{
|
||||
PoolingManager.Instance.ClearBullets();
|
||||
//GameController.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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dej2tbl70yiyp
|
||||
59
Scripts/Components/FSM/Boss/3D/Idle.cs
Normal file
59
Scripts/Components/FSM/Boss/3D/Idle.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Boss._3D;
|
||||
|
||||
public partial class Idle : EnemyStateBase3D
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Idle;
|
||||
|
||||
[Export] public EnemyStorage3D Storage { get; private set; }
|
||||
|
||||
[Export] public GravityProvider GravityProvider { get; private set; }
|
||||
|
||||
[Export] public bool DebugEnabled { get; set; } = false;
|
||||
|
||||
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
// player detection
|
||||
// damage receiver will be a module
|
||||
GD.Print("Entered Idle");
|
||||
|
||||
_ = DelayStart();
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
// Disable DamageReceiver
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task DelayStart()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
ChangeState(EnemyState.Shooting);
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z);
|
||||
|
||||
MainObject.MoveAndSlide();
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Boss/3D/Idle.cs.uid
Normal file
1
Scripts/Components/FSM/Boss/3D/Idle.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://05agh8h015fy
|
||||
45
Scripts/Components/FSM/Boss/3D/Shooting.cs
Normal file
45
Scripts/Components/FSM/Boss/3D/Shooting.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Boss._3D;
|
||||
|
||||
public partial class Shooting : EnemyStateBase3D
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Shooting;
|
||||
|
||||
[Export] public EnemyStorage3D Storage { get; private set; }
|
||||
|
||||
[Export] public GravityProvider GravityProvider { get; private set; }
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
// Enable damage receiver
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
// Calculate gravity
|
||||
MainObject.Velocity = new Vector3(MainObject.Velocity.X, GravityProvider.CalculateGravityVelocity(MainObject.Velocity.Y, delta), MainObject.Velocity.Z);
|
||||
|
||||
MainObject.MoveAndSlide();
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Boss/3D/Shooting.cs.uid
Normal file
1
Scripts/Components/FSM/Boss/3D/Shooting.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d2838a10x33w8
|
||||
|
|
@ -141,5 +141,9 @@ public partial class PoolingManager : Node
|
|||
//this.CreateChild<Bullet>(bulletData.BulletScene);
|
||||
return bullet as IBullet;
|
||||
}
|
||||
|
||||
|
||||
public void ClearBullets()
|
||||
{
|
||||
// TODO: Implement
|
||||
}
|
||||
}
|
||||
61
Scripts/Resources/BulletScripts/SimpleMovementPattern3D.cs
Normal file
61
Scripts/Resources/BulletScripts/SimpleMovementPattern3D.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using Cirno.Scripts.AttackPatterns;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.BulletScripts;
|
||||
|
||||
[GlobalClass]
|
||||
[Tool]
|
||||
public partial class SimpleMovementPattern3D : AttackPattern
|
||||
{
|
||||
[Export] private Vector2 relativeTargetPosition;
|
||||
[Export] private float moveDuration = 2f;
|
||||
[Export] private Tween.TransitionType transitionType = Tween.TransitionType.Linear;
|
||||
[Export] private Tween.EaseType easeType = Tween.EaseType.InOut;
|
||||
|
||||
public override IPatternMachine MakeMachine(Node parent)
|
||||
{
|
||||
return new SimpleMovementPatternMachine(this, parent);
|
||||
}
|
||||
|
||||
public class SimpleMovementPatternMachine(SimpleMovementPattern3D pattern, Node parent) : IPatternMachine
|
||||
{
|
||||
public Node Parent => parent;
|
||||
|
||||
private Tween tween;
|
||||
private bool isComplete = false;
|
||||
|
||||
protected IScriptHost3D Boss;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (parent is not IScriptHost3D boss)
|
||||
return;
|
||||
|
||||
Boss = boss;
|
||||
tween = Parent.CreateTween();
|
||||
isComplete = false;
|
||||
|
||||
Vector2 targetPosition = (Boss?.HomePosition.ToVector2() ?? boss.ParentObject.GlobalPosition.ToVector2()) + pattern.relativeTargetPosition;
|
||||
|
||||
var targetPosition3D = targetPosition.ToVector3(boss.ParentObject.GlobalPosition.Y);
|
||||
|
||||
boss.ChangeSpriteDirection(-(boss.ParentObject.GlobalPosition.ToVector2() - targetPosition));
|
||||
tween.TweenProperty(boss.ParentObject, "global_position", targetPosition3D, pattern.moveDuration)
|
||||
.SetTrans(pattern.transitionType)
|
||||
.SetEase(pattern.easeType)
|
||||
.Finished += () =>
|
||||
{
|
||||
isComplete = true;
|
||||
boss.ChangeSpriteDirection(Vector2.Zero);
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdatePattern(double delta) { }
|
||||
|
||||
public bool IsComplete()
|
||||
{
|
||||
return isComplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://fo8sf11p058s
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Modifiers;
|
||||
|
||||
|
|
@ -6,7 +7,7 @@ namespace Cirno.Scripts.Resources.Modifiers;
|
|||
[Tool]
|
||||
public partial class DelayedContinuousRotationModifier : TimeModifier
|
||||
{
|
||||
public override void Update(Bullet bullet, double delta, double elapsed)
|
||||
public override void Update(IBullet bullet, double delta, double elapsed)
|
||||
{
|
||||
bullet.RotateSpriteDegrees((float)(Value * delta));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Modifiers;
|
||||
|
||||
|
|
@ -6,7 +7,7 @@ namespace Cirno.Scripts.Resources.Modifiers;
|
|||
[Tool]
|
||||
public partial class DelayedPlayerFacingModifier : TimeModifier
|
||||
{
|
||||
public override void Start(Bullet bullet)
|
||||
public override void Start(IBullet bullet)
|
||||
{
|
||||
bullet.FacePlayer();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Modifiers;
|
||||
|
||||
|
|
@ -6,7 +7,7 @@ namespace Cirno.Scripts.Resources.Modifiers;
|
|||
[Tool]
|
||||
public partial class DelayedRotationModifier : TimeModifier
|
||||
{
|
||||
public override void Start(Bullet bullet)
|
||||
public override void Start(IBullet bullet)
|
||||
{
|
||||
bullet.RotateBullet(this.Value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Modifiers;
|
||||
|
|
@ -13,7 +14,7 @@ public partial class DelayedSpeedIncreaseModifier : TimeModifier
|
|||
|
||||
[Export] public float Duration { get; set; } = 1.0f;
|
||||
|
||||
public override void Update(Bullet bullet, double delta, double elapsed)
|
||||
public override void Update(IBullet bullet, double delta, double elapsed)
|
||||
{
|
||||
float easedValue = ApplyEasing(Value, elapsed);
|
||||
bullet.Speed += easedValue;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Modifiers;
|
||||
|
|
@ -7,7 +8,7 @@ namespace Cirno.Scripts.Resources.Modifiers;
|
|||
[Tool]
|
||||
public partial class DelayedSpeedModifier : TimeModifier
|
||||
{
|
||||
public override void Start(Bullet bullet)
|
||||
public override void Start(IBullet bullet)
|
||||
{
|
||||
bullet.Speed = this.Value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
|
@ -28,12 +29,12 @@ public partial class TimeModifier : Resource
|
|||
return this.MemberwiseClone() as TimeModifier;
|
||||
}
|
||||
|
||||
public virtual void Start(Bullet bullet)
|
||||
public virtual void Start(IBullet bullet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Update(Bullet bullet, double delta, double elapsed)
|
||||
public virtual void Update(IBullet bullet, double delta, double elapsed)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
|||
using Cirno.Scripts.Components;
|
||||
using Cirno.Scripts.Controllers;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Weapons;
|
||||
|
|
@ -31,6 +32,8 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
public bool IsFrozen { get; private set; } = false;
|
||||
public bool Enabled { get; private set; } = false;
|
||||
|
||||
public float SpriteRotation { get; private set; } = 0f;
|
||||
|
||||
[Signal]
|
||||
public delegate void OnDestroyEventHandler();
|
||||
|
||||
|
|
@ -120,26 +123,26 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
|
||||
private void ApplyTimeModifiers(double delta)
|
||||
{
|
||||
return;
|
||||
// foreach (var modifier in _modifiers)
|
||||
// {
|
||||
// if (_elapsedTime >= modifier.TimeModifier.TimeInSeconds)
|
||||
// {
|
||||
// if (!modifier.Applied)
|
||||
// {
|
||||
// modifier.Applied = true;
|
||||
// modifier.TimeModifier.Start(this);
|
||||
// modifier.Elapsed = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// modifier.Elapsed += delta;
|
||||
// }
|
||||
//
|
||||
// modifier.TimeModifier.Update(this, delta, modifier.Elapsed);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
foreach (var modifier in _modifiers)
|
||||
{
|
||||
if (_elapsedTime >= modifier.TimeModifier.TimeInSeconds)
|
||||
{
|
||||
if (!modifier.Applied)
|
||||
{
|
||||
modifier.Applied = true;
|
||||
modifier.TimeModifier.Start(this);
|
||||
modifier.Elapsed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
modifier.Elapsed += delta;
|
||||
}
|
||||
|
||||
modifier.TimeModifier.Update(this, delta, modifier.Elapsed);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RotateBullet(float degrees)
|
||||
|
|
@ -148,29 +151,43 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
_direction = _direction.Rotated(radians).Normalized(); // Rotate direction
|
||||
|
||||
if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return;
|
||||
RotateSprite(SpriteRotation + radians);
|
||||
//SetRotation(Rotation + radians);
|
||||
}
|
||||
|
||||
public virtual void RotateSpriteDegrees(float degrees)
|
||||
{
|
||||
if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return;
|
||||
|
||||
SpriteRotation = Mathf.DegToRad(Mathf.RadToDeg(SpriteRotation) + degrees);
|
||||
|
||||
//SetRotationDegrees(RotationDegrees + degrees);
|
||||
}
|
||||
|
||||
public virtual void RotateSprite(float radians)
|
||||
{
|
||||
if (!BulletInfo.Attributes.HasFlag(BulletFlags.Rotateable)) return;
|
||||
SpriteRotation += radians;
|
||||
|
||||
Vector3 axis = Basis.FromEuler(new Vector3(
|
||||
Mathf.DegToRad(-45f),
|
||||
Mathf.DegToRad(45f),
|
||||
0f
|
||||
)).Z;
|
||||
|
||||
Rotate(axis, radians);
|
||||
|
||||
//SetRotation(Rotation + radians);
|
||||
}
|
||||
|
||||
public void FacePlayer()
|
||||
{
|
||||
// if (_gameManager.Player != null)
|
||||
// {
|
||||
// //_direction = (_gameManager.PlayerPosition.Value - this.GlobalPosition).Normalized();
|
||||
// RotateBullet(0); // quick hack to rotate lasers
|
||||
// //LookAt(player.GlobalPosition);
|
||||
// }
|
||||
if (GameController.Instance.PlayerPosition.HasValue)
|
||||
{
|
||||
_direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - this.GlobalPosition.ToVector2()).Normalized();
|
||||
RotateBullet(0); // quick hack to rotate lasers
|
||||
//LookAt(player.GlobalPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,25 +3,26 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bbdrws471xslc"
|
||||
path="res://.godot/imported/Rumia-world.png-3b229aec4edfb5dbe1c947d2fb9bd71d.ctex"
|
||||
path.s3tc="res://.godot/imported/Rumia-world.png-3b229aec4edfb5dbe1c947d2fb9bd71d.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Rumia-world.png"
|
||||
dest_files=["res://.godot/imported/Rumia-world.png-3b229aec4edfb5dbe1c947d2fb9bd71d.ctex"]
|
||||
dest_files=["res://.godot/imported/Rumia-world.png-3b229aec4edfb5dbe1c947d2fb9bd71d.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
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/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -31,4 +32,4 @@ 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
|
||||
detect_3d/compress_to=0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue