This commit is contained in:
Marco 2025-02-14 13:27:30 +01:00
commit efd6283487
15 changed files with 177 additions and 35 deletions

View file

@ -0,0 +1,5 @@
[style name="VN"]
join Cirno left
join Rumia right
Cirno: I'm the strongest!
Rumia: Gah, I get it, I'll follow you

View file

@ -1,21 +1,25 @@
[gd_resource type="Resource" script_class="BossPhase" load_steps=8 format=3 uid="uid://hy1alw04fbds"]
[gd_resource type="Resource" script_class="BossPhase" load_steps=13 format=3 uid="uid://hy1alw04fbds"]
[ext_resource type="Script" path="res://Scripts/Resources/BossPhase.cs" id="1_kkx86"]
[ext_resource type="PackedScene" uid="uid://djro6xmsq7kqk" path="res://Scenes/Weapons/Bullets/enemyBullet_mid_blue_laser.tscn" id="1_nfjet"]
[ext_resource type="Script" path="res://Scripts/AttackPatterns/SpiralPattern.cs" id="2_peiit"]
[ext_resource type="Script" path="res://Scripts/AttackPatterns/LaserPattern.cs" id="2_tctyt"]
[ext_resource type="Script" path="res://Scripts/Resources/TimeModifier.cs" id="2_v7sed"]
[ext_resource type="PackedScene" uid="uid://dbcj1u77spk6p" path="res://Scenes/Weapons/Bullets/enemyBullet_rice_yellow_small.tscn" id="4_7kssw"]
[sub_resource type="Resource" id="Resource_e62ka"]
script = ExtResource("2_v7sed")
TimeInSeconds = 0.8
ModifierType = 0
Value = 0.0
Continuous = false
[sub_resource type="Resource" id="Resource_vkf1u"]
script = ExtResource("2_v7sed")
TimeInSeconds = 0.9
ModifierType = 2
Value = 0.0
Continuous = false
[sub_resource type="Resource" id="Resource_3idsw"]
script = ExtResource("2_tctyt")
@ -39,9 +43,50 @@ _timeModifiers = Array[Object]([SubResource("Resource_e62ka"), SubResource("Reso
_targetPlayer = false
WaitForCompletion = true
[sub_resource type="Resource" id="Resource_bs25y"]
script = ExtResource("2_v7sed")
TimeInSeconds = 2.0
ModifierType = 1
Value = -90.0
Continuous = false
[sub_resource type="Resource" id="Resource_7tuk4"]
script = ExtResource("2_peiit")
BulletScene = ExtResource("4_7kssw")
bulletSpeed = 40.0
bulletCount = 16
rotationSpeed = 0.0
_rotationOffset = 0.0
duration = 0.1
burstInterval = 8.0
spread = 360.0
owner = 2
_damageType = 0
_bulletDamage = 1.0
_timeModifiers = Array[Object]([SubResource("Resource_bs25y")])
_targetPlayer = false
WaitForCompletion = true
[sub_resource type="Resource" id="Resource_reykq"]
script = ExtResource("2_peiit")
BulletScene = ExtResource("4_7kssw")
bulletSpeed = 40.0
bulletCount = 16
rotationSpeed = 0.0
_rotationOffset = 0.0
duration = 4.0
burstInterval = 8.0
spread = 360.0
owner = 2
_damageType = 0
_bulletDamage = 1.0
_timeModifiers = Array[Object]([SubResource("Resource_bs25y")])
_targetPlayer = false
WaitForCompletion = false
[resource]
script = ExtResource("1_kkx86")
PhaseName = ""
PhaseName = "Lasers test"
Threshold = 0
PlayAnimation = false
Patterns = Array[Object]([SubResource("Resource_3idsw")])
PlayAnimation = true
Patterns = Array[Object]([SubResource("Resource_3idsw"), SubResource("Resource_7tuk4"), SubResource("Resource_reykq")])

View file

@ -15,6 +15,7 @@ script = ExtResource("2_kghxb")
TimeInSeconds = 1.0
ModifierType = 1
Value = 90.0
Continuous = false
[sub_resource type="Resource" id="Resource_puvpt"]
script = ExtResource("2_wkmhk")
@ -38,6 +39,7 @@ script = ExtResource("2_kghxb")
TimeInSeconds = 1.0
ModifierType = 1
Value = -90.0
Continuous = false
[sub_resource type="Resource" id="Resource_44j24"]
script = ExtResource("2_wkmhk")
@ -145,12 +147,14 @@ script = ExtResource("2_kghxb")
TimeInSeconds = 0.5
ModifierType = 2
Value = 0.0
Continuous = false
[sub_resource type="Resource" id="Resource_krtsy"]
script = ExtResource("2_kghxb")
TimeInSeconds = 0.8
ModifierType = 0
Value = 50.0
Continuous = false
[sub_resource type="Resource" id="Resource_mpjrl"]
script = ExtResource("2_wkmhk")
@ -259,6 +263,6 @@ WaitForCompletion = true
[resource]
script = ExtResource("1_fdlxv")
PhaseName = "Darkness Sign \"Demarcation\""
Threshold = 100
Threshold = 50
PlayAnimation = true
Patterns = Array[Object]([SubResource("Resource_puvpt"), SubResource("Resource_44j24"), SubResource("Resource_wkxow"), SubResource("Resource_gcqck"), SubResource("Resource_bxbto"), SubResource("Resource_q48s1"), SubResource("Resource_erexw"), SubResource("Resource_mpjrl"), SubResource("Resource_l05f2"), SubResource("Resource_ncfnl"), SubResource("Resource_q7cr0"), SubResource("Resource_vkthc"), SubResource("Resource_8kl6r"), SubResource("Resource_n2gn4"), SubResource("Resource_ha2b6")])

View file

@ -92,6 +92,6 @@ WaitForCompletion = true
[resource]
script = ExtResource("3_o6234")
PhaseName = "Night Sign \"Night Bird\""
Threshold = 200
Threshold = 100
PlayAnimation = true
Patterns = Array[Resource]([SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_5fq8v"), SubResource("Resource_gm1rv"), SubResource("Resource_upj22"), SubResource("Resource_gm1rv"), SubResource("Resource_nl664"), SubResource("Resource_gm1rv")])

View file

@ -40,6 +40,6 @@ WaitForCompletion = false
[resource]
script = ExtResource("1_0cgch")
PhaseName = ""
Threshold = 300
Threshold = 150
PlayAnimation = false
Patterns = Array[Resource]([SubResource("Resource_acaax"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_o8win"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_k77ig"), ExtResource("2_7n56o"), ExtResource("3_mwcf3"), SubResource("Resource_5ocg5"), ExtResource("2_7n56o"), ExtResource("3_mwcf3")])

View file

@ -30,10 +30,10 @@ collision_layer = 16
collision_mask = 9
script = ExtResource("1_na4uq")
BossName = "Rumia"
Phases = Array[Resource]([ExtResource("2_p8j4e"), ExtResource("2_1rhf6"), ExtResource("3_j7lbl"), ExtResource("2_eyxw4")])
Phases = Array[Resource]([ExtResource("2_1rhf6"), ExtResource("3_j7lbl"), ExtResource("2_eyxw4"), ExtResource("2_p8j4e")])
BossHudPrefab = ExtResource("4_ehp8q")
_bossPortraitTexture = ExtResource("4_at5iq")
Health = 400.0
Health = 200.0
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ using Godot.Collections;
namespace Cirno.Scripts.Activables;
public partial class ScriptableBase : Node2D
public partial class ScriptableBase : Node2D, IActivable
{
[Export] public Array<EventResource> Events;
@ -59,4 +59,9 @@ public partial class ScriptableBase : Node2D
// StartPhase(CurrentPhase);
// }
}
public void Activate(ActivationType activationType = ActivationType.Toggle)
{
Start();
}
}

View file

@ -11,6 +11,8 @@ public partial class Boss : Enemy, IActivable
[Export] public string BossName { get; private set; }
[Export] private Array<BossPhase> Phases;
[Export] private PackedScene BossHudPrefab;
[Export] public Vector2 BossPhaseAnimationStartingPosition = new Vector2(180, 10);
private int currentPhaseIndex = 0;
private bool _started = false;
@ -27,9 +29,6 @@ public partial class Boss : Enemy, IActivable
[Export]
public Vector2 CameraOffset = Vector2.Zero;
// [Export]
// private PackedScene _bossPhaseAnimationPrefab;
private TextureRect _animationTextureRect;
[Export]
@ -74,20 +73,12 @@ public partial class Boss : Enemy, IActivable
_bossHud.CallDeferred("add_child", _animationTextureRect);
//canvas.AddChild(animationTextureRect);
_animationTextureRect.Position = new Vector2(180, 10);
_animationTextureRect.Position = BossPhaseAnimationStartingPosition;
_animationTextureRect.Visible = false;
//var animation = _bossPhaseAnimationPrefab.Instantiate<BossPhaseAnimation>();
// _gameManager.AddChild(animation);
}
}
}
public override void _Process(double delta)
@ -105,6 +96,18 @@ public partial class Boss : Enemy, IActivable
StartPhase(CurrentPhase);
}
}
protected override void Explode()
{
if (_bossHud is not null)
{
_bossHud.QueueFree();
}
_gameManager.CameraTargetPlayer();
base.Explode();
}
private void StartPhase(BossPhase phase)
{
@ -150,6 +153,7 @@ public partial class Boss : Enemy, IActivable
private async Task PlayAnimation()
{
_animationTextureRect.Modulate = new Color(_animationTextureRect.Modulate.R, _animationTextureRect.Modulate.G, _animationTextureRect.Modulate.B, 0f);
_animationTextureRect.Position = BossPhaseAnimationStartingPosition;
_animationTextureRect.Visible = true;
var tween = GetTree().CreateTween();

View file

@ -99,11 +99,7 @@ public partial class SpiralPattern : AttackPattern
RotationOffset = angleOffset,
Modifier = _modifier,
TimeModifiers = ((_timeModifiers?.Where(mod => mod != null)) ?? Array.Empty<TimeModifier>()).Select(m =>
new ModifierWrapper()
{
TimeModifier = m,
Applied = false
}).ToList()
m.Wrap()).ToList()
};
}

View file

@ -70,7 +70,10 @@ public partial class Bullet : Area2D
break;
}
modifier.Applied = true;
if (!modifier.TimeModifier.Continuous)
{
modifier.Applied = true;
}
}
}
}

View file

@ -25,6 +25,7 @@ public partial class Enemy : CharacterBody2D
[Export] public float AlarmReactRange = 200f;
[Export] public Weapon EquippedWeapon;
[Export] public Node2D DefeatScript;
protected float _currentHealth = 0f;
@ -218,13 +219,30 @@ public partial class Enemy : CharacterBody2D
}
private void Explode()
protected virtual void Explode()
{
Debug.WriteLine("Ded");
if (DefeatScript is not null)
{
ActivateDefeatScript();
}
//CreateParticles();
//CreateDebris();
QueueFree();
}
protected void ActivateDefeatScript()
{
if (DefeatScript is not IActivable target)
{
GD.PrintErr($"Target {DefeatScript.Name} is not activable");
return;
}
target?.Activate();
GD.Print($"{DefeatScript.Name} activated");
}
public void Hit(float damage)
{

View file

@ -0,0 +1,9 @@
using Godot;
namespace Cirno.Scripts.Resources.Modifiers;
[GlobalClass]
public partial class DelayedSpeedModifier : TimeModifier
{
}

View file

@ -8,17 +8,38 @@ public partial class TimeModifier : Resource
[Export] public float TimeInSeconds = 1f;
[Export] public TimeModifierType ModifierType;
[Export] public float Value;
[Export] public bool Continuous = false;
public ModifierWrapper Wrap()
{
return new ModifierWrapper()
{
TimeModifier = this,
Applied = false
};
}
}
public class ModifierWrapper
{
public TimeModifier TimeModifier { get; set; }
public bool Applied { get; set; } = false;
public virtual void Start()
{
}
public virtual void Process(double deltaTime)
{
}
}
public enum TimeModifierType
{
SpeedChange,
RotationChange,
FacePlayer
FacePlayer,
Dynamic
}

View file

@ -43,6 +43,7 @@ directories/dtl_directory={
"Rumia_Intro": "res://Dialogue/Timelines/Rumia_Intro.dtl",
"computer1": "res://Dialogue/Timelines/computer1.dtl",
"computer2": "res://Dialogue/Timelines/computer2.dtl",
"rumia_defeat": "res://Dialogue/Timelines/rumia_defeat.dtl",
"testintro": "res://Dialogue/Timelines/testintro.dtl",
"timeline": "res://Dialogue/timeline.dtl"
}