reworking effects, turning them into their own scene for replicability

This commit is contained in:
2026-02-03 03:37:58 -05:00
parent 36b934b200
commit 435fbc7ba2
32 changed files with 321 additions and 172 deletions

View File

@@ -0,0 +1,58 @@
using Godot;
using System;
using System.Runtime.InteropServices.Marshalling;
public partial class TimeEffect : Effect
{
public int _calls = 0, _maxCalls = 0;
public float _timerSeconds;
public Timer _timer;
public override void _Ready()
{
base._Ready();
_timer = GetNode<Timer>("Timer");
}
public override void _Process(double delta)
{
base._Process(delta);
if (_contact._button._phone._running)
{
_contact._button._progressBar.Value = Math.Round(_timer.TimeLeft / _timerSeconds * 100, 0);
}
}
public override void Fire()
{
base.Fire();
if (_calls <= _maxCalls || _maxCalls == 0)
{
_calls++;
_timer.Start(_timerSeconds);
}
}
public override void End()
{
_contact._button._progressBar.Value = 0;
}
public virtual void SetTimer(float SECONDS)
{
_timerSeconds = SECONDS;
}
public override void Start()
{
base.Start();
_calls = 0;
_timer.Start(_timerSeconds);
}
private void OnTimerTimeout()
{
Fire();
}
}