diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-08-01 01:31:25 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-08-01 01:31:25 +0100 |
| commit | dbf0218371ce006b674b0ede8e6a4d97932ff2c6 (patch) | |
| tree | a865e7ff8e9f65579435b951a0c2ceffd8237c61 /code/phase/AssignPhase.cs | |
| parent | ca0d44610b6216f82fcf8f5830d445963654db64 (diff) | |
Add footprints
Diffstat (limited to 'code/phase/AssignPhase.cs')
| -rw-r--r-- | code/phase/AssignPhase.cs | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/code/phase/AssignPhase.cs b/code/phase/AssignPhase.cs index f29aa62..f69ca7b 100644 --- a/code/phase/AssignPhase.cs +++ b/code/phase/AssignPhase.cs @@ -3,11 +3,10 @@ using Sandbox.UI; using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net.Http.Headers;
namespace MurderGame;
-public class AssignPhase : BasePhase
+public partial class AssignPhase : BasePhase
{
public override string Title => "Assigning teams";
public int TicksElapsed;
@@ -42,18 +41,18 @@ public class AssignPhase : BasePhase "Zulu"
};
- private List<string> HexColours = new()
+ private List<uint> Colors = new()
{
- "#0074D9", // blue
- "#7FDBFF", // aqua
- "#39CCCC", // teal
- "#F012BE", // fuchsia
- "#FF4136", // red
- "#FF851B", // orange
- "#FFDC00", // yellow
- "#3D9970", // olive
- "#2ECC40", // lime
- "#01FF70" // green
+ 0x0074D9, // blue
+ 0x7FDBFF, // aqua
+ 0x39CCCC, // teal
+ 0xF012BE, // fuchsia
+ 0xFF4136, // red
+ 0xFF851B, // orange
+ 0xFFDC00, // yellow
+ 0x3D9970, // olive
+ 0x2ECC40, // lime
+ 0x01FF70 // green
};
public override void Activate()
@@ -63,17 +62,18 @@ public class AssignPhase : BasePhase {
entity.Delete();
}
+ DeleteFootprints();
// cleanup -- end
var detectivesNeeded = 1;
var murderersNeeded = 1;
- Random random = new();
+ Random random = new(Guid.NewGuid().GetHashCode());
var spawnPoints = Entity.All.OfType<SpawnPoint>().OrderBy( _ => random.Next() ).ToList();
var clients = Game.Clients.ToList().OrderBy( _ => random.Next() );
var natoNamesRemaining = new List<string>(NatoNames.OrderBy( _ => random.Next() ));
- var coloursRemaining = new List<string>(HexColours.OrderBy( _ => random.Next() ));
+ var colorsRemaining = new List<uint>(Colors.OrderBy( _ => random.Next() ));
foreach ( var client in clients )
{
@@ -99,9 +99,9 @@ public class AssignPhase : BasePhase {
natoNamesRemaining = new List<string>(NatoNames);
}
- if (coloursRemaining.Count == 0)
+ if (colorsRemaining.Count == 0)
{
- coloursRemaining = new List<string>(HexColours);
+ colorsRemaining = new List<uint>(Colors);
}
// assign team
@@ -134,15 +134,24 @@ public class AssignPhase : BasePhase pawn.CharacterName = natoName;
// assign nato name
- var hexColour = coloursRemaining[0];
- coloursRemaining.RemoveAt( 0 );
- pawn.HexColor = hexColour;
+ var hexColor = colorsRemaining[0];
+ colorsRemaining.RemoveAt( 0 );
+ pawn.Color = Color.FromRgb(hexColor);
RoleOverlay.Show( To.Single( client ) );
}
base.TimeLeft = 5;
}
+ [ClientRpc]
+ public static void DeleteFootprints()
+ {
+ foreach (var entity in Entity.All.OfType<Footprint>())
+ {
+ entity.Delete();
+ }
+ }
+
public override void Deactivate()
{
foreach (var client in Game.Clients)
|
