-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
113 lines (97 loc) · 3.01 KB
/
Copy pathProgram.cs
File metadata and controls
113 lines (97 loc) · 3.01 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using BattleBitAPI;
using BattleBitAPI.Common;
using BattleBitAPI.Server;
using System.Threading.Channels;
using System.Xml;
class Program
{
static void Main(string[] args)
{
var listener = new ServerListener<MyPlayer, MyGameServer>();
listener.Start(29294);
Thread.Sleep(-1);
}
}
class MyPlayer : Player<MyPlayer>
{
public bool IsZombie;
}
class MyGameServer : GameServer<MyPlayer>
{
public override async Task OnRoundStarted()
{
}
public override async Task OnRoundEnded()
{
}
public override async Task OnPlayerConnected(MyPlayer player)
{
bool anyZombiePlayer = false;
foreach (var item in AllPlayers)
{
if (item.IsZombie)
{
anyZombiePlayer = true;
break;
}
}
if (!anyZombiePlayer)
{
player.IsZombie = true;
player.Message("You are the zombie.");
player.Kill();
}
}
public override async Task OnAPlayerKilledAnotherPlayer(OnPlayerKillArguments<MyPlayer> args)
{
if (args.Victim.IsZombie)
{
args.Victim.IsZombie = false;
args.Victim.Message("You are no longer zombie");
AnnounceShort("Choosing new zombie in 5");
await Task.Delay(1000);
AnnounceShort("Choosing new zombie in 4");
await Task.Delay(1000);
AnnounceShort("Choosing new zombie in 3");
await Task.Delay(1000);
AnnounceShort("Choosing new zombie in 2");
await Task.Delay(1000);
AnnounceShort("Choosing new zombie in 1");
await Task.Delay(1000);
args.Killer.IsZombie = true;
args.Killer.SetHeavyGadget(Gadgets.SledgeHammer.ToString(), 0, true);
var position = args.Killer.GetPosition();
}
}
public override async Task<OnPlayerSpawnArguments> OnPlayerSpawning(MyPlayer player, OnPlayerSpawnArguments request)
{
if (player.IsZombie)
{
request.Loadout.PrimaryWeapon = default;
request.Loadout.SecondaryWeapon = default;
request.Loadout.LightGadget = null;
request.Loadout.HeavyGadget = Gadgets.SledgeHammer;
request.Loadout.Throwable = null;
}
return request;
}
public override async Task OnPlayerSpawned(MyPlayer player)
{
if(player.IsZombie)
{
player.SetRunningSpeedMultiplier(2f);
player.SetJumpMultiplier(2f);
player.SetFallDamageMultiplier(0f);
player.SetReceiveDamageMultiplier(0.1f);
player.SetGiveDamageMultiplier(4f);
}
}
public override async Task OnConnected()
{
await Console.Out.WriteLineAsync("Current state: " + RoundSettings.State);
}
public override async Task OnGameStateChanged(GameState oldState, GameState newState)
{
await Console.Out.WriteLineAsync("State changed to -> " + newState);
}
}