mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-13 23:55:55 +00:00
Scriptable bullet emitter
This commit is contained in:
parent
d62538a382
commit
4261009c33
17 changed files with 251 additions and 74 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.AttackPatterns;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.ScriptableBullets;
|
||||
using Cirno.Scripts.UI;
|
||||
|
|
@ -7,7 +8,7 @@ using Godot.Collections;
|
|||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class Boss : Enemy, IActivable
|
||||
public partial class Boss : Enemy, IActivable, IScriptHost
|
||||
{
|
||||
[Export] public string BossName { get; private set; }
|
||||
//[Export] private Array<BossPhase> Phases;
|
||||
|
|
|
|||
64
Scripts/Actors/ScriptableBulletsEmitter.cs
Normal file
64
Scripts/Actors/ScriptableBulletsEmitter.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/ScriptableBulletsEmitter.cs.uid
Normal file
1
Scripts/Actors/ScriptableBulletsEmitter.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c1gu44a1kkmt1
|
||||
Loading…
Add table
Add a link
Reference in a new issue