Friday, 22 August 2025 01:17:08
This commit is contained in:
36
Gameplay/Conditions/Caffeinated.cs
Normal file
36
Gameplay/Conditions/Caffeinated.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user