Bullet resource

This commit is contained in:
Marco 2025-02-12 16:20:55 +01:00
commit 07f6e58ebd
19 changed files with 236 additions and 50 deletions

View file

@ -2,6 +2,7 @@ using Godot;
using System;
using System.Diagnostics;
using Cirno.Scripts;
using Cirno.Scripts.Resources;
public partial class Barrel : Area2D, IDestructible
{
@ -14,8 +15,7 @@ public partial class Barrel : Area2D, IDestructible
[Export] public PackedScene DebrisScene { get; set; }
[Export] public PackedScene ExplosionParticles { get; set; }
[Export] public PackedScene ExplosionScene { get; set; }
[Export] public BulletResource ExplosionData { get; set; }
private float _currentHealth = 0f;
@ -43,11 +43,12 @@ public partial class Barrel : Area2D, IDestructible
private void CreateExplosion()
{
if (ExplosionScene == null) return;
if (ExplosionData == null) return;
var explosion = this.CreateSibling<Bullet>(ExplosionScene);
var explosion = this.CreateSibling<Bullet>(ExplosionData.BulletScene);
explosion.Speed = 0;
explosion.Initialize(ExplosionData.MakeBullet(this.GlobalPosition));
}
private void ApplyExplosionDamage()