Exemple #1
0
 public static MineField GetInstance()
 {
     if (instance == null)
     {
         instance             = new MineField();
         Failed               = new List <Player>();
         Mines                = new ConcurrentDictionary <string, Vector3I>();
         Player.Moving       += new EventHandler <PlayerMovingEventArgs>(PlayerMoving);
         Player.PlacingBlock += new EventHandler <PlayerPlacingBlockEventArgs>(PlayerPlacing);
         _rand                = new Random();
         _stopped             = false;
     }
     return(instance);
 }
Exemple #2
0
        public static void Stop(Player player, bool Won)
        {
            if (Failed != null && Mines != null)
            {
                Failed.Clear();

                foreach (Vector3I m in Mines.Values)
                {
                    Vector3I removed;
                    Mines.TryRemove(m.ToString(), out removed);
                }
            }
            World world = WorldManager.FindWorldOrPrintMatches(player, "Minefield");

            WorldManager.RemoveWorld(world);
            WorldManager.SaveWorldList();
            Server.RequestGC();
            instance = null;
            Server.Players.Message(Won ? "{0}&S Won the game of MineField!" : "{0}&S aborted the game of MineField",
                                   MessageType.Announcement, player.ClassyName);
        }