Basic round loop done

This commit is contained in:
gamer147
2023-08-03 11:45:09 -04:00
parent 39b9f71801
commit 686edc85a3
4 changed files with 59 additions and 8 deletions

View File

@@ -21,7 +21,8 @@ public abstract class Minigame : Entity
/// <summary>
/// Once a minigame is loaded and initialized, this method is called once per server tick.
/// </summary>
public abstract void Tick();
/// <returns>true if the minigame has ended, false otherwise</returns>
public abstract bool Tick();
/// <summary>
/// Cleans up any entities and components created by this minigame.

View File

@@ -16,8 +16,10 @@ public class RussianRouletteMinigame : Minigame
public override string Name => "Russian Roulette";
private List<Lucker> Players { get; set; }
private Pawn Shooter { get; set; }
private const float ShooterDistance = 80f;
private const float TimeBetweenShots = 7f;
private const float TimeBetweenDeathAndEnd = 5f;
private int Taunted = 0;
private List<Pawn> DeadVictims => Players
@@ -26,6 +28,7 @@ public class RussianRouletteMinigame : Minigame
.ToList();
private TimeSince TimeSinceShot { get; set; }
private TimeSince TimeSinceDeadVictim { get; set; }
public override void Initialize( List<Lucker> players )
{
@@ -60,7 +63,7 @@ public class RussianRouletteMinigame : Minigame
TimeSinceShot = 0;
}
public override void Tick()
public override bool Tick()
{
if ( DeadVictims.Any() )
{
@@ -68,10 +71,14 @@ public class RussianRouletteMinigame : Minigame
{
ChatBox.AddChatEntry( To.Everyone, "Shooter", "Heh, nothing personnel, kid." );
Taunted = int.MaxValue;
TimeSinceDeadVictim = 0;
}
else if(TimeSinceDeadVictim > TimeBetweenDeathAndEnd)
{
return true;
}
return;
}
if ( TimeSinceShot > TimeBetweenShots )
else if ( TimeSinceShot > TimeBetweenShots )
{
TimeSinceShot = 0;
Taunted = 0;
@@ -95,6 +102,8 @@ public class RussianRouletteMinigame : Minigame
ChatBox.AddChatEntry( To.Everyone, "Shooter", "Im gettin' ready!" );
Taunted++;
}
return false;
}
public override void Cleanup()