mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-19 07:03:48 +00:00
Pattern burst rotation
This commit is contained in:
parent
6d7a23e2f3
commit
099c8acf5e
10 changed files with 538 additions and 477 deletions
|
|
@ -2545,7 +2545,7 @@
|
||||||
{
|
{
|
||||||
"classname" "actor_emitter_floor"
|
"classname" "actor_emitter_floor"
|
||||||
"origin" "-220 220 60"
|
"origin" "-220 220 60"
|
||||||
"script_path" "res://Resources/BulletScripts/Danmaku_Room_1.tres"
|
"script_path" "res://Resources/BulletScripts/Danmaku_Room_2.tres"
|
||||||
"activationtype" ""
|
"activationtype" ""
|
||||||
"target" ""
|
"target" ""
|
||||||
"targetname" "danmaku_room_1"
|
"targetname" "danmaku_room_1"
|
||||||
|
|
@ -2570,7 +2570,7 @@
|
||||||
{
|
{
|
||||||
"classname" "actor_emitter_floor"
|
"classname" "actor_emitter_floor"
|
||||||
"origin" "-348 220 60"
|
"origin" "-348 220 60"
|
||||||
"script_path" "res://Resources/BulletScripts/Danmaku_Room_1.tres"
|
"script_path" "res://Resources/BulletScripts/Danmaku_Room_2.tres"
|
||||||
"activationtype" ""
|
"activationtype" ""
|
||||||
"target" ""
|
"target" ""
|
||||||
"targetname" "danmaku_room_1"
|
"targetname" "danmaku_room_1"
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -9,11 +9,15 @@
|
||||||
script = ExtResource("3_tp6n0")
|
script = ExtResource("3_tp6n0")
|
||||||
BulletResource = ExtResource("1_ww6vs")
|
BulletResource = ExtResource("1_ww6vs")
|
||||||
bulletCount = 8
|
bulletCount = 8
|
||||||
rotationSpeed = 12.0
|
BurstRotationSpeed = 12.0
|
||||||
UseParentRotationOffset = true
|
UseParentRotationOffset = true
|
||||||
burstInterval = 0.1
|
burstInterval = 0.1
|
||||||
ShotsPerBurst = 4
|
ShotsPerBurst = 4
|
||||||
BurstRate = 2.0
|
BurstRate = 2.0
|
||||||
|
OverrideDamage = true
|
||||||
|
DamageOverride = 20.0
|
||||||
|
OverrideOwner = true
|
||||||
|
Owner = 2
|
||||||
metadata/_custom_type_script = "uid://bxiprx5nwmpnu"
|
metadata/_custom_type_script = "uid://bxiprx5nwmpnu"
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Cirno.Scripts.Actors;
|
using Cirno.Scripts.Actors;
|
||||||
using Cirno.Scripts.Components;
|
using Cirno.Scripts.Components;
|
||||||
|
using Cirno.Scripts.Enums;
|
||||||
using Cirno.Scripts.Resources;
|
using Cirno.Scripts.Resources;
|
||||||
using Cirno.Scripts.Utils;
|
using Cirno.Scripts.Utils;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
@ -11,12 +12,14 @@ namespace Cirno.Scripts.AttackPatterns;
|
||||||
[Tool]
|
[Tool]
|
||||||
public partial class ShootingPattern3D : AttackPattern
|
public partial class ShootingPattern3D : AttackPattern
|
||||||
{
|
{
|
||||||
|
[Export] public LoopType LoopType { get; set; }
|
||||||
[Export] public BulletResource BulletResource { get; set; }
|
[Export] public BulletResource BulletResource { get; set; }
|
||||||
|
|
||||||
[Export] public Vector3 EmitterOffset { get; set; } = Vector3.Zero;
|
[Export] public Vector3 EmitterOffset { get; set; } = Vector3.Zero;
|
||||||
|
|
||||||
[Export] public int bulletCount = 16;
|
[Export] public int bulletCount = 16;
|
||||||
[Export] public float rotationSpeed = 0f;
|
[Export] public float rotationSpeed = 0f;
|
||||||
|
[Export] public float BurstRotationSpeed = 0f;
|
||||||
[Export] public bool UseParentRotationOffset { get; set; } = false;
|
[Export] public bool UseParentRotationOffset { get; set; } = false;
|
||||||
[Export] public float _rotationOffset = 0f;
|
[Export] public float _rotationOffset = 0f;
|
||||||
[Export] public float duration = 5f;
|
[Export] public float duration = 5f;
|
||||||
|
|
@ -31,13 +34,27 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
|
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
|
||||||
|
|
||||||
[ExportCategory("Overrides")]
|
[ExportCategory("Overrides")]
|
||||||
|
|
||||||
|
[ExportGroup("Override Damage")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideDamage { get; private set; } = false;
|
||||||
|
[Export] public float DamageOverride { get; private set; } = 10f;
|
||||||
|
|
||||||
|
[ExportGroup("Override Speed")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideSpeed { get; private set; } = false;
|
||||||
|
[Export] public float SpeedOverride { get; private set; } = 10f;
|
||||||
|
|
||||||
[ExportGroup("Override Owner")]
|
[ExportGroup("Override Owner")]
|
||||||
[Export(PropertyHint.GroupEnable)] public bool OverrideOwner { get; private set; } = false;
|
[Export(PropertyHint.GroupEnable)] public bool OverrideOwner { get; private set; } = false;
|
||||||
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
|
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
|
||||||
[ExportGroup("Override Damage Type")]
|
[ExportGroup("Override Damage Type")]
|
||||||
[Export(PropertyHint.GroupEnable)] public bool OverrideDamageType { get; private set; } = false;
|
[Export(PropertyHint.GroupEnable)] public bool OverrideDamageType { get; private set; } = false;
|
||||||
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
|
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
|
||||||
[ExportGroup("Override Controllable")]
|
|
||||||
|
[ExportGroup("Override Attributes")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideAttributes { get; private set; } = false;
|
||||||
|
[Export] public BulletFlags AttributesOverride { get; private set; }
|
||||||
|
|
||||||
|
[ExportGroup("Override Controllable (deprecated)")]
|
||||||
[Export(PropertyHint.GroupEnable)] public bool OverrideControllable { get; private set; } = false;
|
[Export(PropertyHint.GroupEnable)] public bool OverrideControllable { get; private set; } = false;
|
||||||
[Export] public bool Controllable { get; private set; } = false;
|
[Export] public bool Controllable { get; private set; } = false;
|
||||||
|
|
||||||
|
|
@ -55,6 +72,16 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
var bullet = this.BulletResource.MakeBullet(position, count,
|
var bullet = this.BulletResource.MakeBullet(position, count,
|
||||||
spread, rotationOffset);
|
spread, rotationOffset);
|
||||||
|
|
||||||
|
if (OverrideDamage)
|
||||||
|
{
|
||||||
|
bullet.Damage = this.DamageOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OverrideSpeed)
|
||||||
|
{
|
||||||
|
bullet.Speed = this.SpeedOverride;
|
||||||
|
}
|
||||||
|
|
||||||
if (OverrideOwner)
|
if (OverrideOwner)
|
||||||
{
|
{
|
||||||
bullet.Owner = this.Owner;
|
bullet.Owner = this.Owner;
|
||||||
|
|
@ -65,11 +92,16 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
bullet.DamageType = DamageType;
|
bullet.DamageType = DamageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OverrideControllable)
|
if (OverrideAttributes)
|
||||||
{
|
{
|
||||||
bullet.Controllabe = Controllable;
|
bullet.Attributes = AttributesOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (OverrideControllable)
|
||||||
|
// {
|
||||||
|
// bullet.Controllabe = Controllable;
|
||||||
|
// }
|
||||||
|
|
||||||
if (OverrideCreationModifier)
|
if (OverrideCreationModifier)
|
||||||
{
|
{
|
||||||
bullet.Modifier = this.Modifier;
|
bullet.Modifier = this.Modifier;
|
||||||
|
|
@ -101,6 +133,8 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
|
|
||||||
private int _burstBullets;
|
private int _burstBullets;
|
||||||
|
|
||||||
|
private int _currentBurstOffset = 0;
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
ScriptHost = Parent as IScriptHost3D;
|
ScriptHost = Parent as IScriptHost3D;
|
||||||
|
|
@ -147,6 +181,7 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
if (_burstBullets <= 0)
|
if (_burstBullets <= 0)
|
||||||
{
|
{
|
||||||
_state = ShootStatus.WaitingReload;
|
_state = ShootStatus.WaitingReload;
|
||||||
|
_currentBurstOffset++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -181,7 +216,7 @@ public partial class ShootingPattern3D : AttackPattern
|
||||||
|
|
||||||
private void Shoot()
|
private void Shoot()
|
||||||
{
|
{
|
||||||
float angleOffset = pattern._rotationOffset + (float)(pattern.rotationSpeed * timer);
|
float angleOffset = pattern._rotationOffset + (float)(pattern.rotationSpeed * timer) + (float)(pattern.BurstRotationSpeed * _currentBurstOffset);
|
||||||
|
|
||||||
Vector2 direction = pattern.BulletResource.Direction;
|
Vector2 direction = pattern.BulletResource.Direction;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,15 +43,25 @@ public partial class SpiralPattern : AttackPattern
|
||||||
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
|
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
|
||||||
|
|
||||||
[ExportCategory("Overrides")]
|
[ExportCategory("Overrides")]
|
||||||
[Export] public bool OverrideOwner { get; private set; } = false;
|
|
||||||
|
[ExportGroup("Override Damage")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideDamage { get; private set; } = false;
|
||||||
|
[Export] public float DamageOverride { get; private set; } = 10f;
|
||||||
|
|
||||||
|
[ExportGroup("Override Owner")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideOwner { get; private set; } = false;
|
||||||
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
|
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
|
||||||
[Export] public bool OverrideDamageType { get; private set; } = false;
|
|
||||||
|
[ExportGroup("Override Damage Type")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideDamageType { get; private set; } = false;
|
||||||
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
|
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
|
||||||
[Export] public bool OverrideControllable { get; private set; } = false;
|
|
||||||
[Export] public bool Controllable { get; private set; } = false;
|
[ExportGroup("Override Attributes")]
|
||||||
|
[Export(PropertyHint.GroupEnable)] public bool OverrideAttributes { get; private set; } = false;
|
||||||
|
[Export] public BulletFlags AttributesOverride { get; private set; }
|
||||||
|
|
||||||
[ExportCategory("Extra Modifiers")]
|
[ExportCategory("Extra Modifiers")]
|
||||||
[Export]
|
[Export(PropertyHint.GroupEnable)]
|
||||||
public bool OverrideCreationModifier { get; private set; } = false;
|
public bool OverrideCreationModifier { get; private set; } = false;
|
||||||
|
|
||||||
[Export] public BulletCreationModifier Modifier;
|
[Export] public BulletCreationModifier Modifier;
|
||||||
|
|
@ -72,9 +82,9 @@ public partial class SpiralPattern : AttackPattern
|
||||||
bullet.DamageType = DamageType;
|
bullet.DamageType = DamageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OverrideControllable)
|
if (OverrideAttributes)
|
||||||
{
|
{
|
||||||
bullet.Controllabe = Controllable;
|
bullet.Attributes = AttributesOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OverrideCreationModifier)
|
if (OverrideCreationModifier)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cirno.Scripts.Resources;
|
using Cirno.Scripts.Resources;
|
||||||
|
using Cirno.Scripts.Utils;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace Cirno.Scripts.Components;
|
namespace Cirno.Scripts.Components;
|
||||||
|
|
@ -11,7 +12,7 @@ public class BulletInfo(BulletResource originalBulletResource)
|
||||||
public Vector2 Direction { get; set; }
|
public Vector2 Direction { get; set; }
|
||||||
public float Speed { get; set; }
|
public float Speed { get; set; }
|
||||||
public float LifeTime { get; set; }
|
public float LifeTime { get; set; }
|
||||||
public bool DestroyOnCollision { get; set; }
|
public bool DestroyOnCollision => Attributes.HasNoFlags(BulletFlags.Piercing);
|
||||||
public BulletOwner Owner { get; set; }
|
public BulletOwner Owner { get; set; }
|
||||||
public DamageType DamageType { get; set; }
|
public DamageType DamageType { get; set; }
|
||||||
public float Damage { get; set; }
|
public float Damage { get; set; }
|
||||||
|
|
@ -21,15 +22,17 @@ public class BulletInfo(BulletResource originalBulletResource)
|
||||||
public float RotationOffset { get; set; }
|
public float RotationOffset { get; set; }
|
||||||
//public double Time { get; set; }
|
//public double Time { get; set; }
|
||||||
public float Spread { get; set; }
|
public float Spread { get; set; }
|
||||||
public bool RotateSprite { get; set; } = false;
|
public bool RotateSprite => Attributes.HasFlag(BulletFlags.Rotateable);
|
||||||
public bool Controllabe { get; set; } = false;
|
|
||||||
public bool Freezable { get; set; } = true;
|
public bool Controllabe => Attributes.HasFlag(BulletFlags.Controllable);
|
||||||
|
|
||||||
|
public bool Freezable => Attributes.HasFlag(BulletFlags.Freezable);
|
||||||
public PackedScene BulletScene { get; set; }
|
public PackedScene BulletScene { get; set; }
|
||||||
public PackedScene DestructionParticlesScene { get; set; }
|
public PackedScene DestructionParticlesScene { get; set; }
|
||||||
public IBulletModifier Modifier { get; set; }
|
public IBulletModifier Modifier { get; set; }
|
||||||
public List<TimeModifier> TimeModifiers { get; set; } = new List<TimeModifier>();
|
public List<TimeModifier> TimeModifiers { get; set; } = new List<TimeModifier>();
|
||||||
|
|
||||||
public bool Grazeable { get; set; }
|
public bool Grazeable => Attributes.HasFlag(BulletFlags.Grazeable);
|
||||||
public float GrazeValue { get; set; }
|
public float GrazeValue { get; set; }
|
||||||
|
|
||||||
public BulletFlags Attributes { get; set; }
|
public BulletFlags Attributes { get; set; }
|
||||||
|
|
|
||||||
7
Scripts/Enums/LoopType.cs
Normal file
7
Scripts/Enums/LoopType.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Cirno.Scripts.Enums;
|
||||||
|
|
||||||
|
public enum LoopType
|
||||||
|
{
|
||||||
|
PlayOnce,
|
||||||
|
Loop
|
||||||
|
}
|
||||||
1
Scripts/Enums/LoopType.cs.uid
Normal file
1
Scripts/Enums/LoopType.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bn5p0n583d3tj
|
||||||
|
|
@ -50,13 +50,13 @@ public partial class BulletResource : Resource
|
||||||
RotationOffset = rotationOffset,
|
RotationOffset = rotationOffset,
|
||||||
Modifier = Modifier,
|
Modifier = Modifier,
|
||||||
LifeTime = LifeTime,
|
LifeTime = LifeTime,
|
||||||
DestroyOnCollision = Attributes.HasNoFlags(BulletFlags.Piercing),
|
//DestroyOnCollision = Attributes.HasNoFlags(BulletFlags.Piercing),
|
||||||
DestructionParticlesScene = DestructionParticlesScene,
|
DestructionParticlesScene = DestructionParticlesScene,
|
||||||
RotateSprite = Attributes.HasFlag(BulletFlags.Rotateable),
|
//RotateSprite = Attributes.HasFlag(BulletFlags.Rotateable),
|
||||||
Controllabe = Attributes.HasFlag(BulletFlags.Controllable),
|
//Controllabe = Attributes.HasFlag(BulletFlags.Controllable),
|
||||||
Freezable = Attributes.HasFlag(BulletFlags.Freezable),
|
//Freezable = Attributes.HasFlag(BulletFlags.Freezable),
|
||||||
TimeModifiers = TimeModifiers.Select(x => x).ToList(),
|
TimeModifiers = TimeModifiers.Select(x => x).ToList(),
|
||||||
Grazeable = Attributes.HasFlag(BulletFlags.Grazeable),
|
//Grazeable = Attributes.HasFlag(BulletFlags.Grazeable),
|
||||||
GrazeValue = GrazeValue,
|
GrazeValue = GrazeValue,
|
||||||
Attributes = Attributes,
|
Attributes = Attributes,
|
||||||
// TimeModifiers = TimeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().Select(m => new ModifierWrapper()
|
// TimeModifiers = TimeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().Select(m => new ModifierWrapper()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue