This commit is contained in:
Marco 2025-02-14 10:59:32 +01:00
commit ba2f6a97fc
9 changed files with 254 additions and 26 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Cirno.Scripts.Resources;
using Cirno.Scripts.Weapons;
using Godot;
using Godot.Collections;
@ -18,9 +19,17 @@ public partial class BulletSpawner : Node2D
public void SpawnBullet(BulletInfo bulletInfo)
{
var bulletScene = bulletInfo.BulletScene ?? BulletScene;
Bullet bullet;
for (int i = 0; i < bulletInfo.BulletCount; i++)
{
var bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletInfo.BulletScene ?? BulletScene, bulletInfo.Position);
if (bulletInfo.IsLaser)
bullet = this.CreateChildOf<LaserBullet>(_gameManager.BulletsContainer, bulletScene, bulletInfo.Position);
else
bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletScene, bulletInfo.Position);
// var bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletInfo.BulletScene ?? BulletScene, bulletInfo.Position);
bullet.Initialize(bulletInfo, _gameManager);
@ -91,4 +100,13 @@ public class BulletInfo
public PackedScene DestructionParticlesScene { get; set; }
public IBulletModifier Modifier { get; set; }
public List<ModifierWrapper> TimeModifiers { get; set; } = new List<ModifierWrapper>();
}
#region Laser
public bool IsLaser { get; set; }
public float SpawnDelay { get; set; } = 0.3f; // Delay before beam appears
public float PreFireTime { get; set; } = 0.5f; // Time before laser becomes lethal
public float LethalTime { get; set; } = 1.5f; // Time laser remains lethal
public Color PreFireColor { get; set; } = new Color(1, 0, 0, 0.5f); // Thin red beam
public Color LethalColor { get; set; } = new Color(1, 0, 0, 1.0f); // Thicker beam
#endregion
}