37 lines
881 B
C#
37 lines
881 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class Caffeinated : Condition
|
|
{
|
|
public Caffeinated(Node2D OWNER) : base(OWNER)
|
|
{
|
|
_triggers.Add(Trigger.On.Time);
|
|
_countdown = 2;
|
|
_timer.OneShot = true;
|
|
_timer.WaitTime = _countdown;
|
|
_timer.Autostart = true;
|
|
AddChild(_timer);
|
|
// GetNode<Timer>("Timer").Timeout += Fire;
|
|
if (OWNER is Worker)
|
|
{
|
|
((Worker)OWNER)._staminaCanDrain = false;
|
|
}
|
|
}
|
|
|
|
public override void Fire()
|
|
{
|
|
_expired = true;
|
|
if (_target != null)
|
|
{
|
|
if (_target is Worker)
|
|
{
|
|
Worker target = (Worker)_target;
|
|
target._stamina -= 1;
|
|
target._staminaCanDrain = true;
|
|
target._conditions.Remove(this);
|
|
}
|
|
_target = null;
|
|
}
|
|
}
|
|
}
|