public static void SetMap(FloorPlan addTo, string filePath)
        {
            StreamReader reader = new StreamReader(filePath + "FiveCardDrawGames.txt");

            while (!reader.EndOfStream)
            {
                string[] args     = reader.ReadLine().Split(",");
                Game     thisGame = new Game(int.Parse(args[1]), int.Parse(args[2]), char.Parse(args[0]));
                thisGame.RunGame += FiveCardDraw.FiveCardDraw.Run;
                addTo.AddPiece(thisGame);
            }

            reader.Close();
            reader = new StreamReader(filePath + "HangManGames.txt");

            while (!reader.EndOfStream)
            {
                string[] args     = reader.ReadLine().Split(",");
                Game     thisGame = new Game(int.Parse(args[1]), int.Parse(args[2]), char.Parse(args[0]));
                thisGame.RunGame += HangMan.HangMan.Run;
                addTo.AddPiece(thisGame);
            }

            reader.Close();
            reader = new StreamReader(filePath + "NPCs.txt");

            while (!reader.EndOfStream)
            {
                string[] args       = reader.ReadLine().Split(",");
                Player   thisPlayer = new Player(int.Parse(args[1]), int.Parse(args[2]), char.Parse(args[0]));
                thisPlayer.Movable = true;
                //thisPlayer.InputReceived += AI.AI.Think;
                addTo.AddPiece(thisPlayer);
            }
            reader.Close();
            reader = new StreamReader(filePath + "RoShamBoGames.txt");

            while (!reader.EndOfStream)
            {
                string[] args     = reader.ReadLine().Split(",");
                Game     thisGame = new Game(int.Parse(args[1]), int.Parse(args[2]), char.Parse(args[0]));
                thisGame.RunGame += RoShamBo.RoShamBo.Run;
                addTo.AddPiece(thisGame);
            }

            reader.Close();
        }
Exemple #2
0
        public FloorDoor(FloorPlan side1, FloorPlan side2, int side1X, int side1Y, int side2X, int side2Y)
        {
            Side1 = side1;
            Side2 = side2;
            side1[side1X, side1Y] = this;
            side2[side2X, side2Y] = this;

            Point side1Exit = new Point();
            Point side2Exit = new Point();

            if (side1X == 0)
            {
                side1Exit.X = 1;
            }
            else if (side1X == side1.Rows - 1)
            {
                side1Exit.X = side1.Rows - 2;
            }
            else
            {
                side1Exit.X = side1X;
            }

            if (side1Y == 0)
            {
                side1Exit.Y = 1;
            }
            else if (side1Y == side1.Columns - 1)
            {
                side1Exit.Y = side1.Columns - 2;
            }
            else
            {
                side1Exit.Y = side1Y;
            }

            if (side2X == 0)
            {
                side2Exit.X = 1;
            }
            else if (side2X == side2.Rows - 1)
            {
                side2Exit.X = side2.Rows - 2;
            }
            else
            {
                side2Exit.X = side2X;
            }

            if (side2Y == 0)
            {
                side2Exit.Y = 1;
            }
            else if (side2Y == side2.Columns - 1)
            {
                side2Exit.Y = side2.Columns - 2;
            }
            else
            {
                side2Exit.Y = side2Y;
            }

            ExitSide1 = side1Exit;
            ExitSide2 = side2Exit;
        }