示例#1
0
        public async Task Start()
        {
            try
            {
                CommandWindow.Log("Warmup Starting");
                RoundManager.Broadcast("Warmup Starting");
                State = RoundState.WARMUP;

                LevelManager.RespawnItems();
                Players.ToList().ForEach(p => InterfaceManager.ClearAllUI(p.SteamID));

                await Task.Delay(6000);

                Players.ToList().ForEach(p =>
                {
                    p.SetStatus(PlayerStatus.ALIVE);
                    p.TeleportToMapUnsafe();
                    TTTPlayer.ClearInventoryUnsafe(PlayerTool.getSteamPlayer(p.SteamID));
                });

                await Task.Delay(15000);

                CommandWindow.Log("Round is live");
                RoundManager.Broadcast("The round has started.");

                RoleManager.GeneratePlayerRoles();

                Players.ToList().ForEach(p =>
                {
                    if (p.GetRole() == PlayerRole.TRAITOR || p.GetRole() == PlayerRole.DETECTIVE)
                    {
                        p.SetCredits(2);
                    }
                });

                State = RoundState.LIVE;
            } catch (Exception ex)
            {
                CommandWindow.Log(ex);
            }
        }