mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
50 lines
No EOL
1.4 KiB
C#
50 lines
No EOL
1.4 KiB
C#
using System;
|
|
using Cirno.Scripts.Components;
|
|
using Cirno.Scripts.Resources;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Activables;
|
|
|
|
public partial class BulletEmitter : Node2D, IActivable
|
|
{
|
|
|
|
[Export]
|
|
public BulletResource BulletResource { get; set; }
|
|
|
|
[Export]
|
|
private bool _isEmitting { get; set; } = false;
|
|
|
|
[Export] public float Spread { get; set; } = 0f;
|
|
|
|
[Export] public float Rotation { get; set; } = 0f;
|
|
|
|
private BulletSpawner _bulletSpawner;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_bulletSpawner = GetNode<BulletSpawner>("BulletSpawner");
|
|
}
|
|
|
|
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
|
{
|
|
switch (activationType)
|
|
{
|
|
case ActivationType.Toggle:
|
|
break;
|
|
case ActivationType.Enable:
|
|
_bulletSpawner.SpawnBullet(BulletResource.MakeBullet(this.GlobalPosition, 1, Spread, Rotation));
|
|
break;
|
|
case ActivationType.Disable:
|
|
break;
|
|
case ActivationType.Use:
|
|
_bulletSpawner.SpawnBullet(BulletResource.MakeBullet(this.GlobalPosition, 1, Spread, Rotation));
|
|
break;
|
|
case ActivationType.Destroy:
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException(nameof(activationType), activationType, null);
|
|
}
|
|
|
|
|
|
}
|
|
} |