diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2023-08-06 17:21:45 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2023-08-06 17:21:45 +0100 |
| commit | 0bba89a7858ce091f485e04284f853e1f7f304af (patch) | |
| tree | 89ba42616e0f245cc84c96cc5b353eea117057d0 /code/Game.cs | |
| parent | 87d74b50bf443bf199be05bd03afdca6ece082ff (diff) | |
Diffstat (limited to 'code/Game.cs')
| -rw-r--r-- | code/Game.cs | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/code/Game.cs b/code/Game.cs index 356cd38..8903155 100644 --- a/code/Game.cs +++ b/code/Game.cs @@ -1,13 +1,11 @@ -
+using System;
+using System.Linq;
using Sandbox;
using Sandbox.UI;
-using System;
-using System.Collections.Generic;
-using System.Linq;
namespace MurderGame;
-public partial class MurderGame : Sandbox.GameManager
+public partial class MurderGame : GameManager
{
public MurderGame()
{
@@ -17,10 +15,7 @@ public partial class MurderGame : Sandbox.GameManager }
}
- public static MurderGame Instance
- {
- get => Current as MurderGame;
- }
+ public static MurderGame Instance => Current as MurderGame;
[ConVar.Server( "mu_min_players", Help = "The minimum number of players required to start a round." )]
@@ -31,23 +26,23 @@ public partial class MurderGame : Sandbox.GameManager [ConVar.Server( "mu_round_time", Help = "The amount of time, in seconds, in a round." )]
public static int RoundTime { get; set; } = 600;
-
- [ConVar.Client( "mu_max_footprint_time", Help = "The amount of time, in seconds, footprints are visible for. Max 30 seconds." )]
+
+ [ConVar.Client( "mu_max_footprint_time",
+ Help = "The amount of time, in seconds, footprints are visible for. Max 30 seconds." )]
public static int MaxFootprintTime { get; set; } = 30;
- [Net]
- public BasePhase CurrentPhase { get; set; } = new WaitPhase() { CountIn = true };
+ [Net] public BasePhase CurrentPhase { get; set; } = new WaitPhase { CountIn = true };
[GameEvent.Tick.Server]
public void TickServer()
{
CurrentPhase.Tick();
-
- if (CurrentPhase.NextPhase != null && CurrentPhase.IsFinished)
+
+ if ( CurrentPhase.NextPhase != null && CurrentPhase.IsFinished )
{
CurrentPhase.Deactivate();
CurrentPhase = CurrentPhase.NextPhase;
- Log.Info("Advancing phase to " + CurrentPhase.ToString());
+ Log.Info( "Advancing phase to " + CurrentPhase );
CurrentPhase.Activate();
}
}
@@ -61,7 +56,7 @@ public partial class MurderGame : Sandbox.GameManager client.Pawn = pawn;
pawn.Spawn();
- var spawnpoints = Entity.All.OfType<SpawnPoint>();
+ var spawnpoints = All.OfType<SpawnPoint>();
var randomSpawnPoint = spawnpoints.OrderBy( x => Guid.NewGuid() ).FirstOrDefault();
if ( randomSpawnPoint != null )
{
@@ -75,9 +70,8 @@ public partial class MurderGame : Sandbox.GameManager public override void ClientDisconnect( IClient client, NetworkDisconnectionReason reason )
{
- base.ClientDisconnect(client, reason );
+ base.ClientDisconnect( client, reason );
- ChatBox.Say( client.Name + " left the game (" + reason.ToString() + ")" );
+ ChatBox.Say( client.Name + " left the game (" + reason + ")" );
}
}
-
|
