27 lines
564 B
C#
27 lines
564 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
using System.Linq;
|
|
|
|
public partial class GodCircuitAttacks : Timer
|
|
{
|
|
[Export]
|
|
public Array<PackedScene> _attacks;
|
|
|
|
private int _currentAttack = 0;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (GetTree().GetFirstNodeInGroup("Player") != null)
|
|
Paused = false;
|
|
else
|
|
Paused = true;
|
|
}
|
|
|
|
public void OnTimeout()
|
|
{
|
|
_currentAttack = GD.RandRange(0, _attacks.Count - 1);
|
|
var attack = _attacks.ElementAt(_currentAttack).Instantiate();
|
|
AddChild(attack);
|
|
}
|
|
}
|