mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 03:25:54 +00:00
Enemy debris
This commit is contained in:
parent
54b4d94491
commit
0293291315
19 changed files with 175 additions and 27 deletions
22
Scripts/Actors/DeathDebris3D.cs
Normal file
22
Scripts/Actors/DeathDebris3D.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class DeathDebris3D : Node3D
|
||||
{
|
||||
[Export] public EnemyResource EnemyResource { get; private set; }
|
||||
[Export] public AnimatedSprite3D Sprite { get; private set; }
|
||||
|
||||
public void Init(EnemyResource enemyResource)
|
||||
{
|
||||
EnemyResource = enemyResource;
|
||||
|
||||
if (EnemyResource.DeathAnimation is not null)
|
||||
{
|
||||
Sprite.SetSpriteFrames(enemyResource.DeathAnimation);
|
||||
}
|
||||
|
||||
Sprite.Play();
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/DeathDebris3D.cs.uid
Normal file
1
Scripts/Actors/DeathDebris3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cd2j7yiat8uuh
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
|
|
@ -15,5 +16,15 @@ public partial class Dead : EnemyStateBase3D
|
|||
// player detection
|
||||
// damage receiver will be a module
|
||||
MainObject.Hide();
|
||||
if (Storage.EnemyData.DebrisScene is not null)
|
||||
{
|
||||
var debris = Storage.EnemyData.DebrisScene.Instantiate<DeathDebris3D>();
|
||||
MainObject.GetParent().AddChild(debris);
|
||||
debris.GlobalPosition = MainObject.GlobalPosition;
|
||||
debris.Init(Storage.EnemyData);
|
||||
}
|
||||
|
||||
|
||||
MainObject.QueueFree();
|
||||
}
|
||||
}
|
||||
|
|
@ -33,9 +33,13 @@ public partial class EnemyResource : Resource
|
|||
/// </summary>
|
||||
[Export] public float ResponseTime { get; private set; } = 0.5f;
|
||||
|
||||
[ExportCategory("Graphics")]
|
||||
[Export] public Texture2D IconSprite { get; private set; }
|
||||
[Export] public SpriteFrames AnimationFrames { get; private set; }
|
||||
|
||||
[Export] public PackedScene DebrisScene { get; private set; }
|
||||
[Export] public SpriteFrames DeathAnimation { get; private set; }
|
||||
[ExportCategory("Scripts")]
|
||||
[Export] public BossScript BossScript { get; private set; }
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue