mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
64 lines
No EOL
1.4 KiB
C#
64 lines
No EOL
1.4 KiB
C#
using System;
|
|
using Cirno.Scripts.AttackPatterns;
|
|
using Cirno.Scripts.Resources;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Actors;
|
|
|
|
public partial class ScriptableBulletsEmitter : Area2D, IActivable, IScriptHost
|
|
{
|
|
[Export]
|
|
public BulletScript Script { get; private set; }
|
|
|
|
|
|
private bool _isActive = false;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_homePosition = this.GlobalPosition;
|
|
}
|
|
|
|
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
|
{
|
|
switch (activationType)
|
|
{
|
|
case ActivationType.Use:
|
|
case ActivationType.Toggle:
|
|
_isActive = !_isActive;
|
|
break;
|
|
case ActivationType.Close:
|
|
case ActivationType.Enable:
|
|
_isActive = true;
|
|
break;
|
|
case ActivationType.Open:
|
|
case ActivationType.Disable:
|
|
_isActive = false;
|
|
break;
|
|
case ActivationType.Destroy:
|
|
_isActive = false;
|
|
break;
|
|
}
|
|
|
|
if (_isActive)
|
|
{
|
|
Script.Start(this);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (!_isActive) return;
|
|
|
|
Script.UpdatePhase(delta);
|
|
}
|
|
|
|
private Vector2 _homePosition;
|
|
public Vector2 HomePosition => _homePosition;
|
|
|
|
public void ChangeSpriteDirection(Vector2 direction)
|
|
{
|
|
|
|
}
|
|
} |