Moved rumia NS 1 to spiral pattern

This commit is contained in:
Marco 2025-02-12 16:51:00 +01:00
commit 1db132d77d
4 changed files with 46 additions and 5 deletions

View file

@ -29,6 +29,7 @@ owner = 2
_damageType = 0 _damageType = 0
_bulletDamage = 1.0 _bulletDamage = 1.0
_timeModifiers = Array[Resource]([]) _timeModifiers = Array[Resource]([])
_targetPlayer = false
WaitForCompletion = true WaitForCompletion = true
[sub_resource type="Resource" id="Resource_7yi74"] [sub_resource type="Resource" id="Resource_7yi74"]
@ -45,6 +46,7 @@ owner = 2
_damageType = 0 _damageType = 0
_bulletDamage = 1.0 _bulletDamage = 1.0
_timeModifiers = null _timeModifiers = null
_targetPlayer = false
WaitForCompletion = true WaitForCompletion = true
[sub_resource type="Resource" id="Resource_gm1rv"] [sub_resource type="Resource" id="Resource_gm1rv"]

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://Scripts/Resources/BossPhase.cs" id="1_0cgch"] [ext_resource type="Script" path="res://Scripts/Resources/BossPhase.cs" id="1_0cgch"]
[ext_resource type="Script" path="res://Scripts/Resources/SimpleMovementPattern.cs" id="1_xksf5"] [ext_resource type="Script" path="res://Scripts/Resources/SimpleMovementPattern.cs" id="1_xksf5"]
[ext_resource type="Resource" uid="uid://csudslb5tliw4" path="res://Resources/Patterns/rumia_ns_1.tres" id="2_3486e"] [ext_resource type="Resource" uid="uid://jjky5fqn74qk" path="res://Resources/Patterns/rumia_ns_1_spiralized.tres" id="2_7n56o"]
[ext_resource type="Resource" uid="uid://du2kuv125vbrx" path="res://Resources/Patterns/rumia_ns_2.tres" id="3_mwcf3"] [ext_resource type="Resource" uid="uid://du2kuv125vbrx" path="res://Resources/Patterns/rumia_ns_2.tres" id="3_mwcf3"]
[sub_resource type="Resource" id="Resource_acaax"] [sub_resource type="Resource" id="Resource_acaax"]
@ -40,4 +40,4 @@ WaitForCompletion = false
[resource] [resource]
script = ExtResource("1_0cgch") script = ExtResource("1_0cgch")
Threshold = 999 Threshold = 999
Patterns = Array[Resource]([SubResource("Resource_acaax"), ExtResource("2_3486e"), ExtResource("3_mwcf3"), SubResource("Resource_o8win"), ExtResource("2_3486e"), ExtResource("3_mwcf3"), SubResource("Resource_k77ig"), ExtResource("2_3486e"), ExtResource("3_mwcf3"), SubResource("Resource_5ocg5"), ExtResource("2_3486e"), ExtResource("3_mwcf3")]) 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

@ -0,0 +1,27 @@
[gd_resource type="Resource" script_class="SpiralPattern" load_steps=5 format=3 uid="uid://jjky5fqn74qk"]
[ext_resource type="PackedScene" uid="uid://bi3f14klscvlw" path="res://Scenes/Weapons/Bullets/enemyBullet_mid_red.tscn" id="1_iwsrv"]
[ext_resource type="Script" path="res://Scripts/Resources/DecreasingSpeedModifier.cs" id="2_etidu"]
[ext_resource type="Script" path="res://Scripts/AttackPatterns/SpiralPattern.cs" id="3_ryait"]
[sub_resource type="Resource" id="Resource_jeq72"]
script = ExtResource("2_etidu")
decreaseRate = 4.0
[resource]
script = ExtResource("3_ryait")
BulletScene = ExtResource("1_iwsrv")
bulletSpeed = 70.0
bulletCount = 10
rotationSpeed = 0.0
_rotationOffset = 0.0
duration = 3.0
burstInterval = 0.3
spread = 0.0
owner = 2
_damageType = 0
_bulletDamage = 1.0
_modifier = SubResource("Resource_jeq72")
_timeModifiers = null
_targetPlayer = true
WaitForCompletion = true

View file

@ -25,10 +25,14 @@ public partial class SpiralPattern : AttackPattern
[Export] private Resource _modifier; [Export] private Resource _modifier;
[Export] private Array<Resource> _timeModifiers; [Export] private Array<Resource> _timeModifiers;
[Export] private bool _targetPlayer = false;
private double timer; private double timer;
private double burstTimer; private double burstTimer;
private BulletSpawner spawner; private BulletSpawner spawner;
private GameManager _gameManager;
public override void Start(Boss boss) public override void Start(Boss boss)
{ {
Boss = boss; Boss = boss;
@ -43,12 +47,20 @@ public partial class SpiralPattern : AttackPattern
burstTimer += delta; burstTimer += delta;
if (timer < duration && burstTimer >= burstInterval) if (timer < duration && burstTimer >= burstInterval)
{ {
float angleOffset = (float)(rotationSpeed * timer); float angleOffset = _rotationOffset + (float)(rotationSpeed * timer);
Vector2 direction = Vector2.Right;
;
if (_targetPlayer && Boss.GameManager.PlayerPosition.HasValue)
{
direction = (Boss.GameManager.PlayerPosition.Value - Boss.GlobalPosition).Normalized();
}
spawner.SpawnBullet(new BulletInfo() spawner.SpawnBullet(new BulletInfo()
{ {
Position = Boss.GlobalPosition, Position = Boss.GlobalPosition,
Direction = Vector2.Right, Direction = direction,
Speed = bulletSpeed, Speed = bulletSpeed,
Owner = owner, Owner = owner,
DamageType = _damageType, DamageType = _damageType,
@ -56,7 +68,7 @@ public partial class SpiralPattern : AttackPattern
BulletCount = bulletCount, BulletCount = bulletCount,
Spread = spread, Spread = spread,
BulletScene = BulletScene, BulletScene = BulletScene,
RotationOffset = _rotationOffset, RotationOffset = angleOffset,
Modifier = _modifier as IBulletModifier, Modifier = _modifier as IBulletModifier,
TimeModifiers = _timeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().ToList() ?? new List<TimeModifier>() TimeModifiers = _timeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().ToList() ?? new List<TimeModifier>()
}); });