Updates based on PR feedback
This commit is contained in:
@@ -15,8 +15,8 @@ public abstract class Minigame : Entity
|
||||
/// <summary>
|
||||
/// Initializes the minigame with a list of luckers playing it.
|
||||
/// </summary>
|
||||
/// <param name="players">the players who made it into the minigame</param>
|
||||
public abstract void Initialize(List<Lucker> players);
|
||||
/// <param name="luckers">the luckers who made it into the minigame</param>
|
||||
public abstract void Initialize(List<Lucker> luckers);
|
||||
|
||||
/// <summary>
|
||||
/// Once a minigame is loaded and initialized, this method is called once per server tick.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace LuckerGame.Minigames.RussianRoulette;
|
||||
public class RussianRouletteMinigame : Minigame
|
||||
{
|
||||
public override string Name => "Russian Roulette";
|
||||
private List<Lucker> Players { get; set; }
|
||||
private List<Lucker> Luckers { get; set; }
|
||||
private Pawn Shooter { get; set; }
|
||||
|
||||
private const float ShooterDistance = 80f;
|
||||
@@ -24,43 +24,43 @@ public class RussianRouletteMinigame : Minigame
|
||||
private int Taunted = 0;
|
||||
private Pawn ShooterTarget;
|
||||
|
||||
private List<Pawn> DeadVictims => Players
|
||||
.Select( player => player.Pawn as Pawn )
|
||||
private List<Pawn> DeadVictims => Luckers
|
||||
.Select( lucker => lucker.Pawn as Pawn )
|
||||
.Where( pawn => pawn is not { IsValid: true } || pawn.LifeState != LifeState.Alive )
|
||||
.ToList();
|
||||
|
||||
private TimeSince TimeSinceShot { get; set; }
|
||||
private TimeSince TimeSinceDeadVictim { get; set; }
|
||||
|
||||
public override void Initialize( List<Lucker> players )
|
||||
public override void Initialize( List<Lucker> luckers )
|
||||
{
|
||||
Players = players;
|
||||
Luckers = luckers;
|
||||
Shooter = new Pawn();
|
||||
Shooter.Name = ShooterName;
|
||||
var shooterInventory = Shooter.Components.Create<PawnInventory>();
|
||||
shooterInventory.AddWeapon( new RussianPistol() );
|
||||
|
||||
// Setup cameras for players
|
||||
Players.ForEach( player =>
|
||||
// Setup cameras for luckers
|
||||
Luckers.ForEach( lucker =>
|
||||
{
|
||||
player.Components.Create<RTSCamera>();
|
||||
player.Position = Shooter.Position;
|
||||
lucker.Components.Create<RTSCamera>();
|
||||
lucker.Position = Shooter.Position;
|
||||
} );
|
||||
|
||||
Players.Select((player, i) => (Player: player, Index: i) ).ToList().ForEach( pair =>
|
||||
Luckers.Select((lucker, i) => (Lucker: lucker, Index: i) ).ToList().ForEach( pair =>
|
||||
{
|
||||
var player = pair.Player;
|
||||
var lucker = pair.Lucker;
|
||||
var index = pair.Index;
|
||||
var pawn = new Pawn();
|
||||
pawn.Name = player.Name;
|
||||
pawn.Name = lucker.Name;
|
||||
pawn.Tags.Add( "victim" );
|
||||
pawn.Health = 1;
|
||||
player.Pawn = pawn;
|
||||
pawn.DressFromClient( player.Client );
|
||||
lucker.Pawn = pawn;
|
||||
pawn.DressFromClient( lucker.Client );
|
||||
|
||||
var pawnOffset = ShooterDistance * (index % 2 == 0 ? Vector3.Forward : Vector3.Right) * (index % 4 >= 2 ? -1 : 1);
|
||||
|
||||
player.Pawn.Position = Shooter.Position + pawnOffset;
|
||||
lucker.Pawn.Position = Shooter.Position + pawnOffset;
|
||||
pawn.LookAt(Shooter.Position);
|
||||
} );
|
||||
TimeSinceShot = 0;
|
||||
@@ -95,7 +95,7 @@ public class RussianRouletteMinigame : Minigame
|
||||
}
|
||||
else if ( TimeSinceShot > TimeBetweenShots * .8f && Taunted == 1)
|
||||
{
|
||||
ShooterTarget = Players.Select( player => player.Pawn as Pawn )
|
||||
ShooterTarget = Luckers.Select( lucker => lucker.Pawn as Pawn )
|
||||
.OrderBy( _ => Guid.NewGuid() )
|
||||
.FirstOrDefault();
|
||||
Shooter.LookAt( ShooterTarget.Position );
|
||||
|
||||
Reference in New Issue
Block a user