mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-05 00:05:55 +00:00
Added resources to bullets
This commit is contained in:
parent
78c319224a
commit
28671c098b
11 changed files with 329 additions and 24 deletions
|
|
@ -12,19 +12,20 @@ namespace Cirno.Scripts.AttackPatterns;
|
|||
[GlobalClass]
|
||||
public partial class SpiralPattern : AttackPattern
|
||||
{
|
||||
[Export] public BulletResource BulletResource { get; set; }
|
||||
[Export] public PackedScene BulletScene;
|
||||
[Export] private float _bulletLifeTime = 20f;
|
||||
[Export] private bool _destroyOnCollision = false;
|
||||
[Export] private float bulletSpeed = 5f;
|
||||
[Export] private float _bulletLifeTime = 20f; // Switch to res
|
||||
[Export] private bool _destroyOnCollision = false; // Switch to res
|
||||
[Export] private float bulletSpeed = 5f; // Switch to res
|
||||
[Export] private int bulletCount = 16;
|
||||
[Export] private float rotationSpeed = 0f;
|
||||
[Export] private float _rotationOffset = 0f;
|
||||
[Export] private float duration = 5f;
|
||||
[Export] private float burstInterval = 0.5f;
|
||||
[Export] private float spread = 360f;
|
||||
[Export] private BulletOwner owner = BulletOwner.Enemy;
|
||||
[Export] private DamageType _damageType = DamageType.Neutral;
|
||||
[Export] private float _bulletDamage = 1f;
|
||||
[Export] private BulletOwner owner = BulletOwner.Enemy; // Switch to res
|
||||
[Export] private DamageType _damageType = DamageType.Neutral; // Switch to res
|
||||
[Export] private float _bulletDamage = 1f; // Switch to res
|
||||
[ExportGroup("Modifiers")]
|
||||
[Export] private BulletCreationModifier _modifier;
|
||||
[ExportGroup("Modifiers")]
|
||||
|
|
@ -52,14 +53,18 @@ public partial class SpiralPattern : AttackPattern
|
|||
{
|
||||
float angleOffset = _rotationOffset + (float)(rotationSpeed * timer);
|
||||
|
||||
Vector2 direction = Vector2.Right;
|
||||
Vector2 direction = BulletResource.Direction;
|
||||
|
||||
if (_targetPlayer && Boss.GameManager.PlayerPosition.HasValue)
|
||||
{
|
||||
direction = (Boss.GameManager.PlayerPosition.Value - Boss.GlobalPosition).Normalized();
|
||||
}
|
||||
|
||||
var bullet = BulletResource.MakeBullet(Boss.GlobalPosition, bulletCount, spread, angleOffset);
|
||||
bullet.Direction = direction;
|
||||
|
||||
spawner.SpawnBullet(MakeBullet(Boss.GlobalPosition, direction, angleOffset));
|
||||
//spawner.SpawnBullet(MakeBullet(Boss.GlobalPosition, direction, angleOffset));
|
||||
spawner.SpawnBullet(bullet);
|
||||
|
||||
// spawner.SpawnBullet(new BulletInfo()
|
||||
// {
|
||||
|
|
@ -87,6 +92,9 @@ public partial class SpiralPattern : AttackPattern
|
|||
|
||||
protected virtual BulletInfo MakeBullet(Vector2 position, Vector2 direction, float angleOffset)
|
||||
{
|
||||
var bl = BulletResource.MakeBullet(position, bulletCount, angleOffset);
|
||||
bl.Direction = direction;
|
||||
|
||||
return new BulletInfo()
|
||||
{
|
||||
Position = position,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue