mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 06:15:54 +00:00
Death animations and spawner
This commit is contained in:
parent
4fd31d7988
commit
16b7d936c9
13 changed files with 286 additions and 11 deletions
31
Scripts/Actors/ActorSpawner.cs
Normal file
31
Scripts/Actors/ActorSpawner.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class ActorSpawner : Node2D, IActivable
|
||||
{
|
||||
[Export]
|
||||
public PackedScene ActorPrefab { get; set; }
|
||||
|
||||
[Export] public bool WaitForActorDeath { get; private set; } = true;
|
||||
|
||||
public Actor SpawnedActor { get; private set; }
|
||||
|
||||
public virtual void Spawn()
|
||||
{
|
||||
SpawnedActor = this.CreateSibling<Actor>(ActorPrefab);
|
||||
}
|
||||
|
||||
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
if (!WaitForActorDeath)
|
||||
{
|
||||
Spawn();
|
||||
}
|
||||
else if (SpawnedActor == null)
|
||||
{
|
||||
Spawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue