Saturday, 31 January 2026 01:00:43

This commit is contained in:
2026-01-31 01:00:45 -05:00
parent d9d33f9758
commit 672e91d381
38 changed files with 374 additions and 424 deletions

View File

@@ -1,27 +1,73 @@
using Godot;
using System;
using System.Runtime.CompilerServices;
public partial class Contact : Sprite2D
{
public Player _player;
public int _number;
public bool _clickable, _interval;
public int _number, _calls = 0, _maxCalls = 0;
public Timer _timer, _cooldown;
public Action _action;
public Actor _owner;
public override void _Ready()
{
_timer = GetNode<Timer>("Timer");
_cooldown = GetNode<Timer>("Cooldown");
_action = GetNode<Action>("Action");
}
public virtual void CallAction()
{
if (_cooldown.TimeLeft > 0 || _action._cooldownSeconds == 0)
{
GD.Print("Action fired!!");
_action.Fire();
}
}
public void PassNumber(int NUMBER)
{
_number = NUMBER;
}
public void PassPlayer(Player PLAYER)
public void PassOwner(Actor OWNER)
{
_player = PLAYER;
_owner = OWNER;
_action._owner = OWNER;
}
public void SetTimer(float SECONDS)
{
_action._timerSeconds = SECONDS;
}
public void SetCooldown(int SECONDS)
{
_action._cooldownSeconds = SECONDS;
}
public void Start()
{
// GD.Print(_action._timerSeconds);
if (_action._timerSeconds > 0)
{
_timer.Start(_action._timerSeconds);
_calls = 0;
}
}
private void OnTimerTimeout()
{
if (_calls <= _maxCalls || _maxCalls == 0)
{
CallAction();
_timer.Start(_action._timerSeconds);
_calls++;
}
}
private void OnCooldownTimeout()
{
}
}