Removed Timers for Cooldowns for Items.
This commit is contained in:
@@ -11,9 +11,7 @@ namespace ReallifeGamemode.Server.Util
|
||||
{
|
||||
private readonly Player player;
|
||||
private readonly Vehicle veh;
|
||||
private readonly IUsableItem usableItem;
|
||||
private readonly Timer timer;
|
||||
public readonly DateTime startTime;
|
||||
|
||||
public delegate void PlayerTimerElapsed(Player player, dynamic dynamic);
|
||||
|
||||
@@ -29,23 +27,10 @@ namespace ReallifeGamemode.Server.Util
|
||||
this.timer.Start();
|
||||
}
|
||||
|
||||
public PlayerTimer(Player player, IUsableItem usableItem, float milliseconds = 1000)
|
||||
{
|
||||
this.player = player;
|
||||
this.usableItem = usableItem;
|
||||
this.startTime = DateTime.Now.AddMilliseconds(milliseconds);
|
||||
|
||||
this.timer = new Timer(milliseconds);
|
||||
this.timer.Elapsed += Timer_Elapsed;
|
||||
this.timer.Start();
|
||||
}
|
||||
|
||||
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (veh != null)
|
||||
Elapsed?.Invoke(player, veh);
|
||||
else
|
||||
Elapsed?.Invoke(player, usableItem);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
|
||||
Reference in New Issue
Block a user