コード例 #1
0
        public MazeRoom GetRoom(Vector2 <int, int> RoomLocation)
        {
            MazeRoom defaultroom = new MazeRoom();

            defaultroom.MetaData = "Invalid";
            new object();
            Console.WriteLine("Looking for key at " + RoomLocation.X + ", " + RoomLocation.Y);
            Console.WriteLine(" Result of get Room Key State function is" + getroomkeystate(RoomLocation.X, RoomLocation.Y));
            Console.WriteLine("===Result of GetRoom By Iteration is  " + GetRoomByIteration(RoomLocation.X, RoomLocation.Y).MetaData);



            if (rooms.ContainsKey(new Vector2 <int, int>(RoomLocation.X, RoomLocation.Y)))
            {
                Console.WriteLine("Room at " + RoomLocation.X + "," + RoomLocation.Y + " key[" + RoomLocation.X + "," + RoomLocation.Y + "]" + " Session Name is " + rooms[RoomLocation].SessionName);
            }
            if (rooms.ContainsKey(RoomLocation))

            {
                return(rooms[RoomLocation]);
            }
            else
            {
                return(defaultroom);
            }
        }
コード例 #2
0
        public void RunRoomSession()
        {
            MazeRoom currentroom = mazemap.GetRoomByIteration(player.X, player.Y);
            string   ScriptName  = currentroom.SessionName;

            //Only parse the script if the name isn't blank
            if (currentroom.SessionName != "")
            {
                ScriptRepresentation script = new ScriptRepresentation();
                //Initialize the script
                script.init(ScriptName);
                SpeechScriptInterpreter RoomRunner = new SpeechScriptInterpreter();
                if (FirstRun)
                {
                    RoomRunner.init();
                    FirstRun = false;
                }
                else
                {
                    RoomRunner.Init_Voice(Program.voicename);
                }
                RoomRunner.parse(ScriptName);
                //Console.WriteLine(ScriptName);
            }
            //Move the player again.
            Player_Move();
        }
コード例 #3
0
        public void AddRoom(Vector2 <int, int> RoomLocation, MazeRoom room)
        {
            MazeRoom troom = GetRoomByIteration(RoomLocation.X, RoomLocation.Y);

            if (troom.MetaData == "Invalid")
            {
                rooms.Add(RoomLocation, room);
            }
        }
コード例 #4
0
        public MazeRoom GetRoomByIteration(int x, int y)
        {
            MazeRoom ReturnRoom = new MazeRoom();

            ReturnRoom.MetaData = "Invalid";
            foreach (KeyValuePair <Vector2 <int, int>, MazeRoom> roompair in rooms)
            {
                if (roompair.Key.X == x && roompair.Key.Y == y)
                {
                    ReturnRoom          = roompair.Value;
                    ReturnRoom.MetaData = "Not Invalid";
                    break;
                }
            }
            return(ReturnRoom);
        }
        public void init()
        {
            bool     c       = false;
            bool     o       = true;
            MazeRoom no_room = new MazeRoom();

            no_room.TileNum = 0;
            RoomDirections.Add(no_room);
            MazeRoom SealedRoom = new MazeRoom();

            SealedRoom.TileNum = 1;
            RoomDirections.Add(SealedRoom);
            MazeRoom FourWay = new MazeRoom();

            FourWay.SetAllExits(o, o, o, o);
            FourWay.TileNum = 2;
            MazeRoom VerticalHall = new MazeRoom();

            VerticalHall.SetAllExits(o, c, o, c);
            VerticalHall.TileNum = 3;
            RoomDirections.Add(VerticalHall);
            MazeRoom HorizontalHall = new MazeRoom();

            HorizontalHall.TileNum = 4;
            HorizontalHall.SetAllExits(c, o, c, o);
            MazeRoom SealedWest = new MazeRoom();

            SealedWest.SetAllExits(o, o, o, c);
            SealedWest.TileNum = 5;
            RoomDirections.Add(SealedWest);
            MazeRoom SealedEast = new MazeRoom();

            SealedEast.SetAllExits(o, c, o, o);
            SealedEast.TileNum = 6;
            RoomDirections.Add(SealedEast);
            MazeRoom SealedNorth = new MazeRoom();

            SealedNorth.SetAllExits(c, o, o, o);
            SealedNorth.TileNum = 7;
            RoomDirections.Add(SealedNorth);
            MazeRoom SealedSouth = new MazeRoom();

            SealedSouth.SetAllExits(o, o, c, o);
            SealedSouth.TileNum = 8;
            RoomDirections.Add(SealedSouth);
            MazeRoom SouthExit = new MazeRoom();

            SouthExit.SetAllExits(c, c, o, c);
            SouthExit.TileNum = 9;
            RoomDirections.Add(SouthExit);
            MazeRoom NorthExit = new MazeRoom();

            NorthExit.SetAllExits(o, c, c, c);
            NorthExit.TileNum = 10;
            MazeRoom WestExit = new MazeRoom();

            WestExit.SetAllExits(c, c, c, o);
            WestExit.TileNum = 11;
            RoomDirections.Add(WestExit);
            MazeRoom EastExit = new MazeRoom();

            EastExit.SetAllExits(c, o, c, c);
            EastExit.TileNum = 12;
            RoomDirections.Add(EastExit);
        }
コード例 #6
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (Program.userpreferences.EnabledScriptFeatures.Count > 0)
            {
                //Is maze mode meant to run?
                if (Program.userpreferences.EnabledScriptFeatures.Contains(Program.ScriptFeatures.IncludeInMazeModePool))
                {
                    //This should be all we need to kick off maze mode now (hopefully)
                    MapForm MazeModeMap = new MapForm();


                    SessionGeneratorBase genner = new SessionGeneratorBase();
                    genner.PopulateScriptPoolNoPrefs();

                    genner.Remove_NonPrefs();
                    //The other prefs format, I cannot remember why I set up prefs-mirroring.
                    //Something something -script chaining logic. yeah. Not really needed now. Maybe?
                    Program.userpreferences.ResetAndFillPrefs();

                    //Generate session with 5 to start.
                    genner.GenerateGenericSession(5);
                    MazeModeMap.Show(this.Owner);
                    //Hide this form so it doesn't get in the way.
                    this.Hide();


                    Random MazeRng = new Random(System.DateTime.Now.Second + System.DateTime.Now.Year + System.DateTime.Now.Minute);

                    //You cannot update dictionary's values directly UGH, they are readonly. UGHHH!!
                    ICollection <Vector2 <int, int> > keys = new List <Vector2 <int, int> >(MazeModeMap.mazemap.rooms.Keys);
                    //Randomize the finish room too.
                    int roomindex  = MazeRng.Next(0, MazeModeMap.mazemap.rooms.Keys.Count);
                    int countindex = 0;
                    foreach (Vector2 <int, int> key in keys)
                    {
                        //If the finish is shown display it alongside the actual room.
                        if (countindex == roomindex)
                        {
                            MazeModeMap.mazemap.SetFinishRoom(key.X, key.Y);
                            MazeModeMap.RevealRoomTile(key.X, key.Y, MazeModeMap.PalletizedTiles);
                        }

                        //One final touch up to visually correct a backwards tile on start or something.
                        //--Dont ask questions this fixes stuff.
                        if (key.X == MazeModeMap.mazemap.StartRoom.X && key.Y == MazeModeMap.mazemap.StartRoom.Y)
                        {
                            MazeModeMap.RevealRoomTile(key.X, key.Y, MazeModeMap.PalletizedTiles);
                        }

                        //Just some RNG for defining if a tile has a session on it.
                        int value = MazeRng.Next(13);
                        if (value > 5)
                        {
                            MazeRoom troom_ = MazeModeMap.mazemap.rooms[key];
                            int      index  = MazeRng.Next(0, genner.Session_List.Count());
                            troom_.SessionName             = genner.Session_List.ToArray()[index].FileName;
                            MazeModeMap.mazemap.rooms[key] = troom_;
                        }
                        countindex++;
                    }

                    //And the game loop begins here. Maze Mode Only.

                    MazeModeMap.Player_Move();
                }


                if (!Program.userpreferences.EnabledScriptFeatures.Contains(Program.ScriptFeatures.IncludeInMazeModePool))
                {
                    SessionGeneratorBase genner = new SessionGeneratorBase();
                    genner.PopulateScriptPoolNoPrefs();
                    genner.Remove_NonPrefs();
                    //The other prefs format, I cannot remember why I set up prefs-mirroring.
                    //Something something -script chaining logic. yeah. Not really needed now. Maybe?
                    Program.userpreferences.ResetAndFillPrefs();
                    genner.GenerateGenericSession(5);


                    //f.UpdateTileAt(5, 5, 26);

                    //f.make_map(new Vector2<int, int>(5, 5), new Vector2<int, int>(10, 10), 25);
                    this.Hide();
                    bool first_time = true;
                    foreach (ScriptRepresentation rep in genner.Session_List)
                    {
                        SpeechScriptInterpreter interpreter = new SpeechScriptInterpreter();

                        if (first_time)
                        {
                            interpreter.init();
                            first_time = false;
                            Console.WriteLine("Hypnosis Randomizer Online. Programming you now.");
                        }
                        else
                        {
                            interpreter.Init_Voice(Program.voicename);
                        }
                        //interpreter.say_default("This is a test");
                        interpreter.parse(rep.FileName);
                    }
                }
                Console.WriteLine("Session finished. You may close this window.");
            }
            else
            {
                NoPreferencesSelectedError DialogePopup = new NoPreferencesSelectedError();
                DialogePopup.ShowDialog();
            }
        }
コード例 #7
0
        public void RevealRoomTile(int x, int y, List <TileGraphic> tileset)
        {
            //Console.WriteLine("An item exists here");
            //Now we need to extract some data to process it
            MazeRoom           temproom = mazemap.GetRoom(new Vector2 <int, int>(x, y)); //roompair.Value;
            Vector2 <int, int> Location = new Vector2 <int, int>(x, y);
            int RoomX = Location.X;
            int RoomY = Location.Y;

            //Console.WriteLine("Room X is " + RoomX + " | Room Y is " + RoomY);


            //It is time to check neighboors by using containskey.
            //This method using containskey seems to not even work. Will test later.
            //Todo -> Re test room neighboor checking using containskey, for now the function
            //getroomkeystate of mazemap object will do.
            Vector2 <int, int> North = new Vector2 <int, int>(RoomX, RoomY - 1);
            Vector2 <int, int> East  = new Vector2 <int, int>(RoomX + 1, RoomY);
            Vector2 <int, int> South = new Vector2 <int, int>(RoomX, RoomY + 1);
            Vector2 <int, int> West  = new Vector2 <int, int>(RoomX - 1, RoomY);


            //Todo
            //Remove stuff like TempExit references they are unused.

            //We also need an instance of the struct which the class MazeRoom Provides
            MazeRoom.ExitData TempExitData = new MazeRoom.ExitData();

            //Okay now after this we can use contains key and set the data for each direction as well.
            if (mazemap.rooms.ContainsKey(North))
            {
                TempExitData.NorthExit = true;
            }
            if (mazemap.rooms.ContainsKey(East))
            {
                TempExitData.EastExit = true;
            }
            if (mazemap.rooms.ContainsKey(South))
            {
                TempExitData.SouthExit = true;
            }
            if (mazemap.rooms.ContainsKey(West))
            {
                TempExitData.WestExit = true;
            }

            temproom.LocalExits = TempExitData;
            //TempExitData isn't used

            string             TileControlName = RoomX + "," + RoomY;
            Vector2 <int, int> RoomPos         = new Vector2 <int, int>(RoomX, RoomY);
            PictureBox         Tile            = new PictureBox();
            Control            TileCtn         = this.Controls[TileControlName];

            Tile = (PictureBox)TileCtn;

            //A fix to see if 4 ways can work.
            if (Tile != null)
            {
                Tile.Image = tileset[1].localtile;

                //Save the value
                int neighboor_count = mazemap.CountNeighboors(RoomX, RoomY);

                if (neighboor_count == 4)
                {
                    Tile.Image = tileset[2].localtile;
                }

                //We need to know exact states
                bool NorthNeighboor = mazemap.getroomkeystate(RoomX, RoomY - 1);
                bool SouthNeighboor = mazemap.getroomkeystate(RoomX, RoomY + 1);
                bool EastNeighboor  = mazemap.getroomkeystate(RoomX + 1, RoomY);
                bool WestNeighboor  = mazemap.getroomkeystate(RoomX - 1, RoomY);

                //use these instead for exit metadata later. =p
                temproom.SetAllExits(NorthNeighboor, EastNeighboor, WestNeighboor, SouthNeighboor);


                /*
                 * Corner Tile Numbers
                 * NorthEast 13
                 * SouthEast 14
                 * NorthWest 15
                 * SouthWest 16
                 */

                //solving hallways first
                if (neighboor_count == 2)
                {
                    if (NorthNeighboor && SouthNeighboor)
                    {
                        Tile.Image = tileset[3].localtile;
                    }

                    if (EastNeighboor && WestNeighboor)
                    {
                        Tile.Image = tileset[4].localtile;
                    }

                    //Dealing with corner tiles below.

                    //NorthEast Neighboor Case
                    if (NorthNeighboor && EastNeighboor)
                    {
                        Tile.Image = tileset[13].localtile;
                    }
                    //SouthEast Neighboor Case
                    if (SouthNeighboor && EastNeighboor)
                    {
                        Tile.Image = tileset[14].localtile;
                    }
                    //NorthWest Neighboor Case
                    if (NorthNeighboor && WestNeighboor)
                    {
                        Tile.Image = tileset[15].localtile;
                    }
                    //SouthWest Neighboor Case
                    if (SouthNeighboor & WestNeighboor)
                    {
                        Tile.Image = tileset[16].localtile;
                    }
                }

                //Solving one way exits/entrances
                if (neighboor_count == 1)
                {
                    if (NorthNeighboor)
                    {
                        Tile.Image = tileset[10].localtile;
                    }

                    if (SouthNeighboor)
                    {
                        Tile.Image = tileset[9].localtile;
                    }
                    if (EastNeighboor)
                    {
                        Tile.Image = tileset[12].localtile;
                    }
                    if (WestNeighboor)
                    {
                        Tile.Image = tileset[11].localtile;
                    }
                }

                //Now the hardest one. Three ways.
                if (neighboor_count == 3)
                {
                    if (!SouthNeighboor)
                    {
                        Tile.Image = tileset[8].localtile;
                        //Console.WriteLine("South Sealed at " + RoomX + "," + RoomY);
                    }

                    if (!NorthNeighboor)
                    {
                        Tile.Image = tileset[7].localtile;
                        //Console.WriteLine("North Sealed at " + RoomX + "," + RoomY);
                    }

                    if (!EastNeighboor)
                    {
                        Tile.Image = tileset[6].localtile;
                        //Console.WriteLine("East Sealed at " + RoomX + "," + RoomY);
                    }

                    if (!WestNeighboor)
                    {
                        if (NorthNeighboor && SouthNeighboor && EastNeighboor)
                        {
                            //Attempting to eliminate a bug
                            Tile.Image = tileset[5].localtile;
                        }
                    }
                }
            }
        }
コード例 #8
0
        public void make_map(Vector2 <int, int> startpoint, Vector2 <int, int> endpoint, int targetmoves)
        {
            //Step 1, initialize the tile dir data for the 2nd and third phases.
            TileDirData.init();

            //Set the ID type of the starting tile (the start tile icon) and initialize start X and Y and end X and end Y Coords.
            int start_tile = 13;
            int startx     = startpoint.X;
            int starty     = startpoint.Y;
            int endx       = endpoint.X;
            int endy       = endpoint.Y;

            //Set the start location for the player
            this.player.X = startpoint.X;
            this.player.Y = startpoint.Y;

            //Now we can start the first maze logic hooray

            string     startname = startx + "," + starty;
            PictureBox p         = new PictureBox();
            Control    ctn       = this.Controls[startname];

            p = (PictureBox)ctn;

            Random S               = new Random();
            int    facingdir       = S.Next(1, 5);
            int    startingtilenum = 0;

            //Select the starting facing direction
            int mousefacingdir = 0;
            int mousex         = startpoint.X;
            int mousey         = startpoint.Y;


            p.Image  = tiles_list[13].localtile;
            p.Click += this.onclick_;
            tmap.map[mousex, mousey].TileType = start_tile;


            Vector2 <int, int> currentpos = startpoint;
            //Using the current pos vector of Int, Int, initialize a new MazeRoom object.
            MazeRoom StartRoom = new MazeRoom();

            //Set the start room metadata
            StartRoom.MetaData = "StartRoom";
            //Set the start Room's X and Y
            StartRoom.X = currentpos.X;
            StartRoom.Y = currentpos.Y;

            //Lastly when dealing with the Start Room we need to add it to the rooms dictionary interface
            mazemap.AddRoom(currentpos, StartRoom);
            coords_.Add(currentpos);


            int steps_left = 5;

            for (int moves = 0; moves < targetmoves; moves++)
            {
                //First determine our facing direction
                mousefacingdir = facingdir;
                //Next move the mouse in the facing direction.
                currentpos = movemouse(mousex, mousey, facingdir);


                //figure out which way the mouse moved
                mousex = currentpos.X;
                mousey = currentpos.Y;
                //A safety binding to prevent out of bounds to the left...and up
                if (mousex < 0)
                {
                    mousex = 0;
                }
                if (mousey < 0)
                {
                    mousey = 0;
                }
                if (mousex > tmap.width)
                {
                    mousex = tmap.width;
                }
                if (mousey > tmap.height)
                {
                    mousey = tmap.height;
                }

                currentpos.X = mousex;
                currentpos.Y = mousey;
                string pos_string = mousex + "," + mousey;
                //StartRoom.SessionName = "Scripts/InductionTest.txt";
                MazeRoom TempNewRoom = new MazeRoom();
                TempNewRoom.MetaData = "CreatedRoom";
                mazemap.AddRoom(currentpos, TempNewRoom);
                //new object();



                //and get the control we are on
                p   = new PictureBox();
                ctn = this.Controls[pos_string];
                if (ctn != null)
                {
                    if (tmap.map[mousex, mousey].TileType != start_tile)
                    {
                        p = (PictureBox)ctn;
                    }
                }

                if (p != null)
                {
                    p.Click    += this.onclick_;
                    steps_left -= 1;

                    //Trying to undo start tile replacement.
                    if (currentpos != startpoint)
                    {
                        //This effects all tiles but the start
                        p.Image = tiles_list[0].localtile;
                        this.Refresh();
                    }
                    if (steps_left <= 0)
                    {
                        steps_left = S.Next(1, 9);
                        //Randomize the direction of mouse again
                        facingdir = S.Next(1, 5);
                    }
                }

                //Console.WriteLine("Moves are " + moves + "And target moves is " + targetmoves);

                //Console.Clear();
                Console.SetCursorPosition(mousex, mousey);
                Console.Write("X");
                for (int x = 0; x < 15; x++)
                {
                    for (int y = 0; y < 15; y++)
                    {
                        Console.SetCursorPosition(x, y);
                        bool state = mazemap.getroomkeystate(x, y);
                        if (state)
                        {
                            Console.Write("#");
                        }
                    }
                }
                System.Threading.Thread.Sleep(15);
            }


            //Phase 2 of the system is to figure out room neighboors data.
            //We can do this just using the MazeMap dictionary interface and nothing else.
            //Copy the dictionary
            //Console.WriteLine("This ran");
            Dictionary <Vector2 <int, int>, MazeRoom> RoomDict = mazemap.rooms;

            foreach (KeyValuePair <Vector2 <int, int>, MazeRoom> roompair in RoomDict)
            {
                //Console.WriteLine("An item exists here");
                //Now we need to extract some data to process it
                MazeRoom           temproom = roompair.Value;
                Vector2 <int, int> Location = roompair.Key;
                int RoomX = Location.X;
                int RoomY = Location.Y;

                //Console.WriteLine("Room X is " + RoomX + " | Room Y is " + RoomY);

                /*
                 * Corner Tile Numbers
                 * NorthEast 13
                 * SouthEast 14
                 * NorthWest 15
                 * SouthWest 16
                 */



                //Let's try the function form instead of the below

                //RevealRoomTile(Location.X, Location.Y, tiles_list);

                if (RoomX == mazemap.Finishroom.X && RoomY == mazemap.Finishroom.Y)
                {   //Show them where the finish room is atleast ;P
                    RevealRoomTile(RoomX, RoomY, PalletizedTiles);
                }
                //And the above line simplifies everything to a function
                //Hooray.



                /*
                 *
                 * //It is time to check neighboors by using containskey.
                 *
                 * Vector2<int, int> North = new Vector2<int, int>(RoomX, RoomY - 1);
                 * Vector2<int, int> East = new Vector2<int, int>(RoomX + 1, RoomY);
                 * Vector2<int, int> South = new Vector2<int, int>(RoomX, RoomY + 1);
                 * Vector2<int, int> West = new Vector2<int, int>(RoomX - 1, RoomY);
                 *
                 * //We also need an instance of the struct which the class MazeRoom Provides
                 * MazeRoom.ExitData TempExitData = new MazeRoom.ExitData();
                 *
                 * //Okay now after this we can use contains key and set the data for each direction as well.
                 * if (RoomDict.ContainsKey(North)) { TempExitData.NorthExit = true; }
                 * if (RoomDict.ContainsKey(East)) { TempExitData.EastExit = true; }
                 * if (RoomDict.ContainsKey(South)) { TempExitData.SouthExit = true; }
                 * if (RoomDict.ContainsKey(West)) { TempExitData.WestExit = true; }
                 *
                 * roompair.Value.LocalExits = TempExitData;
                 *
                 * string TileControlName = RoomX + "," + RoomY;
                 * Vector2<int, int> RoomPos = new Vector2<int, int>(RoomX, RoomY);
                 * PictureBox Tile = new PictureBox();
                 * Control TileCtn = this.Controls[TileControlName];
                 * Tile = (PictureBox)TileCtn;
                 *
                 * //A fix to see if 4 ways can work.
                 * if (Tile != null)
                 * {
                 * Tile.Image = tiles_list[1].localtile;
                 *
                 * //Save the value
                 * int neighboor_count = mazemap.CountNeighboors(RoomX, RoomY);
                 *
                 * if (neighboor_count == 4)
                 * {
                 *  Tile.Image = tiles_list[2].localtile;
                 * }
                 *
                 * //We need to know exact states
                 * bool NorthNeighboor = mazemap.getroomkeystate(RoomX, RoomY - 1);
                 * bool SouthNeighboor = mazemap.getroomkeystate(RoomX, RoomY + 1);
                 * bool EastNeighboor = mazemap.getroomkeystate(RoomX + 1, RoomY);
                 * bool WestNeighboor = mazemap.getroomkeystate(RoomX - 1, RoomY);
                 *
                 *
                 *
                 *
                 *
                 *
                 * //solving hallways first
                 * if (neighboor_count == 2)
                 * {
                 *  if (NorthNeighboor && SouthNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[3].localtile;
                 *  }
                 *
                 *  if (EastNeighboor && WestNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[4].localtile;
                 *  }
                 *
                 *  //Dealing with corner tiles below.
                 *
                 *  //NorthEast Neighboor Case
                 *  if (NorthNeighboor && EastNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[13].localtile;
                 *  }
                 *  //SouthEast Neighboor Case
                 *  if (SouthNeighboor && EastNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[14].localtile;
                 *  }
                 *  //NorthWest Neighboor Case
                 *  if (NorthNeighboor && WestNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[15].localtile;
                 *  }
                 *  //SouthWest Neighboor Case
                 *  if (SouthNeighboor & WestNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[16].localtile;
                 *  }
                 *
                 *
                 *
                 *
                 * }
                 *
                 * //Solving one way exits/entrances
                 * if (neighboor_count == 1)
                 * {
                 *  if (NorthNeighboor)
                 *      Tile.Image = tiles_list[10].localtile;
                 *
                 *  if (SouthNeighboor)
                 *      Tile.Image = tiles_list[9].localtile;
                 *  if (EastNeighboor)
                 *      Tile.Image = tiles_list[12].localtile;
                 *  if (WestNeighboor)
                 *      Tile.Image = tiles_list[11].localtile;
                 * }
                 *
                 * //Now the hardest one. Three ways.
                 * if (neighboor_count == 3)
                 * {
                 *  if (!SouthNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[8].localtile;
                 *      //Console.WriteLine("South Sealed at " + RoomX + "," + RoomY);
                 *  }
                 *
                 *  if (!NorthNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[7].localtile;
                 *      //Console.WriteLine("North Sealed at " + RoomX + "," + RoomY);
                 *  }
                 *
                 *  if (!EastNeighboor)
                 *  {
                 *      Tile.Image = tiles_list[6].localtile;
                 *      //Console.WriteLine("East Sealed at " + RoomX + "," + RoomY);
                 *  }
                 *
                 *  if (!WestNeighboor)
                 *  {
                 *      if (NorthNeighboor && SouthNeighboor && EastNeighboor)
                 *      {
                 *          //Attempting to eliminate a bug
                 *          Tile.Image = tiles_list[5].localtile;
                 *
                 *          // Console.WriteLine("West Sealed at " + RoomX + "," + RoomY);
                 *      }
                 *  }
                 * }
                 *
                 * //TempControlsCtn = TempControlsPbox;
                 *
                 *
                 * }
                 *
                 *
                 */
                //With all this set
                //The maze should somehow now show us the correct images.
            }
            //this.done_generating = true;
            //this.Show();
            this.Show();
            //this.done_generating = true;
            //Console.WriteLine("Reached finish somehow");
        }
コード例 #9
0
        public void Player_Move()
        {
            QueryMulti Select = new QueryMulti();
            int        pbx    = player.X;
            int        pby    = player.Y;

            int oldx = player.X;
            int oldy = player.Y;
            //Get Neighboor states.
            bool North = mazemap.getroomkeystate(pbx, pby - 1);
            bool East  = mazemap.getroomkeystate(pbx + 1, pby);
            bool South = mazemap.getroomkeystate(pbx, pby + 1);
            bool West  = mazemap.getroomkeystate(pbx - 1, pby);

            //Setup Buttons
            if (North)
            {
                Select.One.Text = "Move North";
            }
            else
            {
                Select.One.Hide();
            }
            if (East)
            {
                Select.Two.Text = "Move East";
            }
            else
            {
                Select.Two.Hide();
            }
            if (South)
            {
                Select.Three.Text = "Move South";
            }
            else
            {
                Select.Three.Hide();
            }
            if (West)
            {
                Select.Four.Text = "Move West";
            }
            else
            {
                Select.Four.Hide();
            }

            Select.ShowDialog();
            switch (Select.returnvalue)
            {
            case "One":
                pby -= 1;
                break;

            case "Two":
                pbx += 1;
                break;

            case "Three":
                pby += 1;
                break;

            case "Four":
                pbx -= 1;
                break;
            }
            //Update player coords.
            player.X = pbx;
            player.Y = pby;

            //Show where the player moved
            RevealRoomTile(pbx, pby, PalletizedTiles);
            RevealRoomTile(oldx, oldy, tiles_list);
            //If the room exists run the session for it.


            //But not before checking if we're done! :D HOORAY!
            if (mazemap.Finishroom.X == player.X && mazemap.Finishroom.Y == player.Y)
            {
                SpeechScriptInterpreter finished = new SpeechScriptInterpreter();
                finished.Init_Voice(Program.voicename);
                finished.say_default("You have completed the maze. Congragulations!!!!");
                this.Close();
            }

            if (mazemap.getroomkeystate(pbx, pby))
            {
                Console.WriteLine("The room at " + pbx + ", " + pby + " was obviously found. DuUUH");
            }
            MazeRoom currentroom = mazemap.GetRoomByIteration(pbx, pby);

            if (!currentroom.ran_once)
            {
                currentroom.ran_once = true;
                mazemap.rooms[new Vector2 <int, int>(pbx, pby)] = currentroom;
                RunRoomSession();
            }
            else
            {
                Player_Move();
            }
        }