Exemplo n.º 1
0
        bool SetStartLevel(Level level)
        {
            if (level == null)
            {
                List <string> levels = Picker.GetCandidateLevels();
                if (levels == null)
                {
                    return(false);
                }

                MapName = LevelPicker.GetRandomLevel(new Random(), levels);
                Map     = LevelInfo.FindExact(MapName)
                          ?? CmdLoad.LoadLevel(null, MapName);
                if (Map == null)
                {
                    return(false);
                }
            }
            else
            {
                MapName = level.name;
                Map     = level;
            }

            Map.SaveChanges = false;
            Chat.MessageGlobal("A game of zombie survival is starting on: {0}", MapName);
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                if (p.level != Map)
                {
                    continue;
                }
                PlayerJoinedLevel(p, p.level, p.level);
            }

            if (ZSConfig.SetMainLevel)
            {
                Server.mainLevel = Map;
            }
            return(true);
        }