Files
hotdesking/Gameplay/Conditions/Caffeinated.cs

31 lines
704 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);
_timer.Timeout += Fire;
if (_owner is Worker)
{
((Worker)_owner)._agility._effective += 3;
}
}
public override void Fire()
{
_expired = true;
if (_owner is Worker)
{
((Worker)_owner)._agility._effective -= 3;
((Worker)_owner)._conditions.RemoveChild(this);
}
}
}