1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MurderGame;
public enum Team : ushort
{
Spectator = 0,
Murderer = 1,
Detective = 2,
Bystander = 3
}
// why are c# enums so bad
public static class TeamCapabilities
{
public static bool CanSprint(Team team)
{
return team switch
{
Team.Murderer => true,
_ => false,
};
}
public static void GiveLoadouts(Player pawn)
{
pawn.Inventory.Clear();
switch (pawn.Team)
{
case Team.Detective:
GiveDetectiveWeapon(pawn); break;
case Team.Murderer:
GiveMurdererWeapon(pawn); break;
case Team.Spectator:
case Team.Bystander:
default: break;
}
}
private static void GiveDetectiveWeapon( Player pawn )
{
Pistol pistol = new()
{
Ammo = 1
};
pawn.Inventory.SetPrimaryWeapon( pistol );
}
private static void GiveMurdererWeapon(Player pawn)
{
pawn.Inventory.SetPrimaryWeapon( new Knife() );
pawn.Components.Create<FootprintTrackerComponent>();
}
}
public static class TeamOperations
{
public static string GetTeamName(Team team)
{
return team switch
{
Team.Detective => "Detective",
Team.Murderer => "Murderer",
Team.Bystander => "Bystander",
Team.Spectator => "Spectator",
_ => "None",
};
}
public static string GetTeamColour(Team team)
{
return team switch
{
Team.Detective => "#33A0FF",
Team.Murderer => "#FF4136",
Team.Bystander => "#33A0FF",
_ => "#AAAAAA",
};
}
public static string GetTeamDescription(Team team)
{
return team switch
{
Team.Detective => "There is a murderer on the loose! Find out who they are and shoot them before they kill everybody else.",
Team.Murderer => "Kill everybody else in time and avoid detection. At least one other player is armed.",
Team.Bystander => "There is a murderer on the loose! Avoid getting killed and work with others to establish who the murderer is.",
_ => "None",
};
}
}
|