コード例 #1
0
ファイル: LevelLoader.cs プロジェクト: kevincos/PuzzleBox
        public static void LoadLevel(string fileName, PuzzleBox box, MasterGrid grid)
        {
            String loadPath = "LevelData\\" + fileName;

            try
            {
                r = new StreamReader(TitleContainer.OpenStream(loadPath));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid.queues[x, y] != null)
                    {
                        grid.queues[x, y] = new List <PuzzleNode>();
                    }
                }
            }
            for (;;)
            {
                String s = r.ReadLine();
                if (s == null)
                {
                    return;
                }
                string[] data = s.Split(',');
                if (data[0] == "WIN")
                {
                }
                if (data[0] == "LOSE")
                {
                }
                if (data[0] == "BOX")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    int z = Convert.ToInt32(data[3]);

                    box[x, y, z] = new PuzzleNode(data[4]);
                }
                else if (data[0] == "GRID")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    grid[x, y] = new PuzzleNode(data[3]);
                }
                else if (data[0] == "QUEUE")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    int z = Convert.ToInt32(data[3]);
                    grid.queues[x, y].Add(new PuzzleNode(data[4]));
                }
            }
        }
コード例 #2
0
        // Replaces all marked orbs with new random orbs.
        public static bool Replace(PuzzleBox box, MasterGrid grid)
        {
            bool anythingChanged = false;

            AddBoxToGrid(box, grid);

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid[x, y].marked == true)
                    {
                        grid[x, y]      = ReplaceHelper(x, y, grid);
                        anythingChanged = true;
                    }
                }
            }

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid[x, y].marked == true)
                    {
                        grid[x, y]        = grid[x, y].replace_orb;
                        grid[x, y].marked = true;
                    }
                }
            }

            SetBoxFromGrid(box, grid);
            return(anythingChanged);
        }
コード例 #3
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 public static bool AllGray(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if(box[x, y, z].color!=Color.Gray && box[x,y,z].color!=Game.currentSettings.dangerColor)
                     return false;
                 if (box[x, y, z].toggleColor != Color.Gray && box[x, y, z].toggleColor != Game.currentSettings.dangerColor)
                     return false;
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             if(grid.queues[x,y]!=null)
             {
                 for (int i = 0; i < grid.queues[x,y].Count; i++)
                 {
                     if (grid.queues[x, y][i].color != Color.Gray && grid.queues[x, y][i].color != Game.currentSettings.dangerColor)
                         return false;
                 }
             }
             if (grid[x, y].color != Color.Gray && grid[x, y].color != Game.currentSettings.dangerColor)
                 return false;
         }
     }
     return true;
 }
コード例 #4
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson9(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "Okay! Let's combine what we've learned about sets\n" +
                 "and bonus bubbles. See those three green bubbles\n" +
                 "in the upper right?:" +
                 "If we can match our two green bubbles at the\n" +
                 "bottom with them, we can pop 5 bubbles at once!:" +
                 "They'll also get replaced by two bonus bubbles,\n" +
                 "which we can use to get another set!";
     successText = "Nice! That was worth a lot of points!";
     failureText = "" +
                   "Oops! This one is tricky. Don't forget to use\n" +
                   "The shoulder buttons for rotations and the\n" +
                   "triggers to push and pull the bubbles.:" +
                   "Try and get match the bubbles in the upper\n" +
                   "right first!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     grid[3, 0]   = new PuzzleNode(Color.Green);
     grid[4, 1]   = new PuzzleNode(Color.Green);
     grid[4, 2]   = new PuzzleNode(Color.Green);
     grid[0, 2]   = new PuzzleNode(Color.Green);
     box[1, 2, 1] = new PuzzleNode(Color.Green);
     box[1, 2, 2] = new PuzzleNode(Color.Green);
 }
コード例 #5
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson0(PuzzleBox box, MasterGrid grid)
 {
     Clear(box, grid);
     box[1, 2, 2] = new PuzzleNode(Color.Red);
     box[0, 2, 2] = new PuzzleNode(Color.Red);
     grid[3, 0]   = new PuzzleNode(Color.Red);
 }
コード例 #6
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson3(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 0;
     introText          = "" +
                          "In addition, you can use the Left and Right\n" +
                          "Triggers to push and pull the bubbles in the\n" +
                          "Jellyfish's body. Try it now!:" +
                          "Great! That way, you can change which layer of\n" +
                          "bubbles aligns with the tentacles.:" +
                          "Now, use the Left and Right Triggers to match\n" +
                          "the bubbles!";
     successText = "" +
                   "Great! With the Left Control Stick, Shoulder\n" +
                   "Buttons, and Triggers, you can reorient the\n" +
                   "bubbles however you want!:" +
                   "If you need a reminder of the controls, take a\n" +
                   "look around the top and bottom left of the\n" +
                   "screen for a review.";
     Clear(box, grid);
     restrictions         = ControlRestrictions.TriggersOnly;
     grid[0, 1]           = new PuzzleNode(Color.Red);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid[3, 0]           = new PuzzleNode(Color.Yellow);
     grid[4, 3]           = new PuzzleNode(Game.jellyBlue);
     grid[1, 4]           = new PuzzleNode(Color.Green);
     box[0, 0, 0]         = new PuzzleNode(Color.Magenta);
     box[1, 0, 0]         = new PuzzleNode(Color.Red);
     box[2, 2, 0]         = new PuzzleNode(Color.Green);
     box[1, 0, 2]         = new PuzzleNode(Color.Yellow);
     box[2, 2, 2]         = new PuzzleNode(Game.jellyBlue);
 }
コード例 #7
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson2(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 0;
     introText          = "" +
                          "Instead of using the Left Control Stick, you\n" +
                          "can use the Left and Right Shoulder Buttons.\n" +
                          "Try it now!:" +
                          "Good! This will perform a different type of\n" +
                          "rotation. Use the Shoulder Buttons to match\n" +
                          "these bubbles!";
     successText = "" +
                   "Nice! If you can master all 6 types of these\n" +
                   "rotations, you'll do great!";
     restrictions = ControlRestrictions.ShouldersOnly;
     Clear(box, grid);
     grid[0, 1]           = new PuzzleNode(Color.Yellow);
     grid[3, 4]           = new PuzzleNode(Color.Green);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid.queues[0, 1][0] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][1] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta);
     grid[2, 4]           = new PuzzleNode(Color.Orange);
     grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2]         = new PuzzleNode(Color.Yellow);
     box[0, 0, 0]         = new PuzzleNode(Color.Green);
     box[0, 1, 2]         = new PuzzleNode(Color.Orange);
     box[0, 1, 0]         = new PuzzleNode(Game.jellyBlue);
 }
コード例 #8
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson5(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "This next lesson is tricky. Notice the two\n" +
                 "yellow bubbles in Mister Jellyfish's body?:" +
                 "They're right next to each other, but they\n" +
                 "haven't popped!:" +
                 "That's because to pop bubbles, you need to\n" +
                 "match bubbles from the Jellyfish's body with\n" +
                 "the bubbles in the tentacles.:" +
                 "Try to align these two yellow bubbles with the\n" +
                 "yellow bubble in the tentacle to form a\n" +
                 "straight line.";
     successText = "" +
                   "You got it. Remember, sets of bubbles will\n" +
                   "only pop if they form a straight line. So be\n" +
                   "careful!";
     failureText = "" +
                   "Almost! Only sets of bubbles that form a\n" +
                   "straight line will match.";
     Clear(box, grid);
     grid[0, 1]   = new PuzzleNode(Color.Yellow);
     box[0, 2, 2] = new PuzzleNode(Color.Yellow);
     box[0, 2, 1] = new PuzzleNode(Color.Yellow);
     restrictions = ControlRestrictions.None;
 }
コード例 #9
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson4(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "Now let's try and put it together! To match\n" +
                 "these bubbles, you'll need to use the Left and\n" +
                 "Right Triggers to push and pull them.:" +
                 "But, you'll also need to use the Left Control\n" +
                 "Stick and Shoulder Buttons to rotate them!:" +
                 "Try and match all the bubbles!";
     successText = "" +
                   "That's perfect!";
     failureText = "BUG!";
     Clear(box, grid);
     restrictions = ControlRestrictions.None;
     grid[0, 1]   = new PuzzleNode(Color.Green);
     grid[2, 0]   = new PuzzleNode(Color.Orange);
     grid[4, 2]   = new PuzzleNode(Color.Magenta);
     grid[3, 4]   = new PuzzleNode(Game.jellyBlue);
     grid[4, 1]   = new PuzzleNode(Color.Yellow);
     grid[1, 4]   = new PuzzleNode(Color.Red);
     box[0, 0, 0] = new PuzzleNode(Color.Red);
     box[2, 2, 2] = new PuzzleNode(Color.Yellow);
     box[1, 2, 2] = new PuzzleNode(Color.Magenta);
     box[0, 2, 0] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 1] = new PuzzleNode(Color.Green);
     box[2, 1, 1] = new PuzzleNode(Color.Orange);
 }
コード例 #10
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson7(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "Another advanced topic is bonus bubbles! You\n" +
                 "may have noticed that when you match bubbles,\n" +
                 "new ones slide in to take their place.:" +
                 "But what happens if you match against two\n" +
                 "bubbles in different tentacles at the same\n" +
                 "time?:" +
                 "This will create a bonus bubble of the same\n" +
                 "color. Matching bonus bubbles will multiply\n" +
                 "the score of the set by 2!:" +
                 "Try rotating this orange bubble into the\n" +
                 "lower left corner!";
     successText = "" +
                   "Great! In addition to this bubble being\n" +
                   "worth bonus points, you popped 3 outer\n" +
                   "bubbles with just one inner bubble.:" +
                   "That's a useful skill!";
     failureText = "" +
                   "Oops! Try popping the bubbles in the lower\n" +
                   "left corner first. This will give you a bonus\n" +
                   "bubble!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     grid[0, 3]   = new PuzzleNode(Color.Orange);
     grid[1, 4]   = new PuzzleNode(Color.Orange);
     grid[4, 1]   = new PuzzleNode(Color.Orange);
     box[0, 2, 2] = new PuzzleNode(Color.Orange);
 }
コード例 #11
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson6(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "Scoring big sets is tricky. Lets practice some\n" +
                 "more. Try to match all of the bubbles using sets\n" +
                 "of 3 or more!";
     successText = "" +
                   "Awesome! These combos are worth way more points\n" +
                   "than just matching two bubbles at a time.:" +
                   "If you want to be a great Jellyfish doctor,\n" +
                   "you'll need to master spotting when you can\n" +
                   "match these kinds of sets!";
     failureText = "" +
                   "Oops! Remember, you need to rotate the bubbles\n" +
                   "so that all of the same colored bubbles are in\n" +
                   "a straight line!:" +
                   "Use the Right Control Stick to look around and\n" +
                   "get a better view of things!:" +
                   "Finally, don't forget about using the Shoulder\n" +
                   "Buttons for rotations.";
     Clear(box, grid);
     restrictions = ControlRestrictions.None;
     grid[1, 0]   = new PuzzleNode(Color.Green);
     grid[0, 2]   = new PuzzleNode(Game.jellyBlue);
     grid[4, 3]   = new PuzzleNode(Color.Yellow);
     box[2, 0, 2] = new PuzzleNode(Color.Green);
     box[2, 1, 2] = new PuzzleNode(Color.Green);
     box[2, 2, 2] = new PuzzleNode(Color.Green);
     box[1, 2, 0] = new PuzzleNode(Game.jellyBlue);
     box[1, 2, 1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2] = new PuzzleNode(Color.Yellow);
     box[0, 1, 2] = new PuzzleNode(Color.Yellow);
 }
コード例 #12
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson8(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
                 "This technique will be especially important in\n" +
                 "Challenge Mode. Try to match all the bubbles\n" +
                 "here.:" +
                 "To do so, you'll need to get the bonus bubbles\n" +
                 "first again! Focus on the corners that contain\n" +
                 "two bubbles of the same color.:" +
                 "Also, don't forget the basics. Remember you can\n" +
                 "use the left and right triggers to push and pull\n" +
                 "the bubbles.";
     successText = "" +
                   "Perfect! You're almost ready to get started\n" +
                   "for real.";
     failureText = "" +
                   "Oops! Remember, if you match one bubble against\n" +
                   "two tentacles at the same time, it will be\n" +
                   "replaced by a bonus bubble.:" +
                   "You can reuse the bonus bubbles to make more\n" +
                   "matches. Try getting the bonus bubbles first!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     box[0, 1, 2] = new PuzzleNode(Color.Yellow);
     box[0, 0, 0] = new PuzzleNode(Color.Magenta);
     grid[3, 0]   = new PuzzleNode(Color.Magenta);
     grid[4, 1]   = new PuzzleNode(Color.Magenta);
     grid[1, 4]   = new PuzzleNode(Color.Magenta);
     grid[0, 1]   = new PuzzleNode(Color.Yellow);
     grid[1, 0]   = new PuzzleNode(Color.Yellow);
     grid[3, 4]   = new PuzzleNode(Color.Yellow);
 }
コード例 #13
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson1(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 1;
     introText          = "" +
                          "Look at all these bubbles inside Mister\n" +
                          "Jellyfish! The colored ones are toxic! Let's\n" +
                          "see if we can get rid of them.:" +
                          "You can use the Left Control Stick to rotate\n" +
                          "the bubbles in Mister Jellyfish's body.\n" +
                          "Try it now!:" +
                          "Perfect! Try to match up the colored bubbles\n" +
                          "in his body with the bubbles in his tentacles!";
     successText = "" +
                   "Great job! When you aligned the bubbles in\n" +
                   "his body with the bubbles in his tentacles,\n" +
                   "the bubbles popped!";
     Clear(box, grid);
     restrictions         = ControlRestrictions.StickOnly;
     grid[0, 1]           = new PuzzleNode(Color.Yellow);
     grid[3, 4]           = new PuzzleNode(Color.Green);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid.queues[0, 1][0] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][1] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta);
     grid[2, 4]           = new PuzzleNode(Color.Orange);
     grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2]         = new PuzzleNode(Color.Yellow);
     box[0, 0, 0]         = new PuzzleNode(Color.Green);
     box[0, 1, 2]         = new PuzzleNode(Color.Orange);
     box[0, 1, 0]         = new PuzzleNode(Game.jellyBlue);
 }
コード例 #14
0
ファイル: LevelLoader.cs プロジェクト: kevincos/PuzzleBox
        public static void LoadLevel(string fileName, PuzzleBox box, MasterGrid grid)
        {
            String loadPath = "LevelData\\"+fileName;
            try
            {
                r = new StreamReader(TitleContainer.OpenStream(loadPath));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid.queues[x, y] != null)
                        grid.queues[x, y] = new List<PuzzleNode>();
                }
            }
            for(;;)
            {
                String s = r.ReadLine();
                if (s == null)
                    return;
                string[] data = s.Split(',');
                if (data[0] == "WIN")
                {

                }
                if (data[0] == "LOSE")
                {
                }
                if (data[0] == "BOX")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    int z = Convert.ToInt32(data[3]);

                    box[x, y, z] = new PuzzleNode(data[4]);
                }
                else if (data[0] == "GRID")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    grid[x, y] = new PuzzleNode(data[3]);
                }
                else if (data[0] == "QUEUE")
                {
                    int x = Convert.ToInt32(data[1]);
                    int y = Convert.ToInt32(data[2]);
                    int z = Convert.ToInt32(data[3]);
                    grid.queues[x, y].Add(new PuzzleNode(data[4]));
                }
            }
        }
コード例 #15
0
 private static void AddBoxToGrid(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             grid[x + boxOffset, y + boxOffset] = box[box.activeZ, y, x];
         }
     }
 }
コード例 #16
0
 private static void SetBoxFromGrid(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             box[box.activeZ, y, x] = grid[x + boxOffset, y + boxOffset];
         }
     }
 }
コード例 #17
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson10(PuzzleBox box, MasterGrid grid)
 {
     introText = "Almost done! Lets do one more.:" +
                 "There are three blue bubbles in the back right \n" +
                 "of Mister Jellyfish. There also 5 blue bubbles \n" +
                 "in the right tentacles.:" +
                 "If you can bring all three of those blue bubbles \n" +
                 "to the front, you can get 3 bonus bubbles to use \n" +
                 "for a second set!";
     successText = "" +
                   "Super! Looks like you're ready to get to work.\n" +
                   "First, lets go over a few more quick things!:" +
                   "There are three different types of Jellyfish\n" +
                   "surgery to choose from, each of which poses\n" +
                   "unique challenges.:" +
                   "In Emergency mode, you'll race against the clock\n" +
                   "to pop as many bubbles as you can.:" +
                   "Scoring sets of 3 or more bubbles at a time is\n" +
                   "key to getting a high score.:" +
                   "Operation mode is similar, but you can relax and\n" +
                   "take your time. However, you'll have a limited\n" +
                   "number of moves to work with.:" +
                   "Time isn't a factor, but you'll need to plan\n" +
                   "your moves carefully and be efficient to get\n" +
                   "a good score.:" +
                   "Finally, Challenge mode will give you some\n" +
                   "tricky puzzles to solve.:" +
                   "You'll need to use what you've learned here to\n" +
                   "pop all of the bubbles in each patient. If you make\n" +
                   "a wrong move, you might get stuck!:" +
                   "Luckily, in Challenge mode, you can press B to\n" +
                   "undo your last move if you make a mistake.:" +
                   "You'll be awarded a rating after each patient.\n" +
                   "If you earn 3 stars, your patient will make a\n" +
                   "full recovery and return to the sea!:" +
                   "Try to save them all!\n";
     failureText = "" +
                   "Oops! Try to rotate all three blue bubbles in\n" +
                   "back to the front right. Then use the three\n" +
                   "bonus bubbles to make a second set.:" +
                   "Don't forget you can use the Right Control Stick\n" +
                   "to get a better view of bubbles in the back!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     box[2, 0, 2] = new PuzzleNode(Game.jellyBlue);
     box[2, 1, 2] = new PuzzleNode(Game.jellyBlue);
     box[2, 2, 2] = new PuzzleNode(Game.jellyBlue);
     grid[3, 0]   = new PuzzleNode(Game.jellyBlue);
     grid[3, 4]   = new PuzzleNode(Game.jellyBlue);
     grid[4, 1]   = new PuzzleNode(Game.jellyBlue);
     grid[4, 2]   = new PuzzleNode(Game.jellyBlue);
     grid[4, 3]   = new PuzzleNode(Game.jellyBlue);
     grid[1, 4]   = new PuzzleNode(Game.jellyBlue);
 }
コード例 #18
0
ファイル: LevelLoader.cs プロジェクト: kevincos/PuzzleBox
 public static void SaveLevel(PuzzleBox box, MasterGrid grid)
 {
     try
     {
         w = new StreamWriter(TitleContainer.OpenStream(savePath));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 PuzzleNode p = box[x, y, z];
                 w.WriteLine("BOX," + x + "," + y + "," + z + "," + p.ToString());
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             PuzzleNode p = grid[x, y];
             w.WriteLine("GRID," + x + "," + y + "," + p.ToString());
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             if (grid.queues[x, y] != null)
             {
                 for (int z = 0; z < grid.queues[x, y].Count; z++)
                 {
                     PuzzleNode p = grid.queues[x, y][z];
                     w.WriteLine("QUEUE," + x + "," + y + "," + z + "," + p.ToString());
                 }
             }
         }
     }
     w.Flush();
     w.Close();
 }
コード例 #19
0
ファイル: LevelLoader.cs プロジェクト: kevincos/PuzzleBox
 public static void SaveLevel(PuzzleBox box, MasterGrid grid)
 {
     try
     {
         w = new StreamWriter(TitleContainer.OpenStream(savePath));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 PuzzleNode p = box[x,y,z];
                 w.WriteLine("BOX," + x + "," + y + ","+z+"," + p.ToString());
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             PuzzleNode p = grid[x, y];
             w.WriteLine("GRID," + x + "," + y + "," + p.ToString());
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             if (grid.queues[x, y] != null)
             {
                 for (int z = 0; z < grid.queues[x, y].Count; z++)
                 {
                     PuzzleNode p = grid.queues[x, y][z];
                     w.WriteLine("QUEUE," + x + "," + y + "," + z + "," + p.ToString());
                 }
             }
         }
     }
     w.Flush();
     w.Close();
 }
コード例 #20
0
 // Clears state. Called when returning to ready state.
 public static void Clear(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 box[x, y, z].ClearMarking();
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             //if (x == 0 || x == gridSize-1 || y == 0 || y == gridSize-1)
             if (grid.queues[x, y] != null)
             {
                 for (int i = 0; i < grid[x, y].replace_distance; i++)
                 {
                     grid.queues[x, y].RemoveAt(0);
                     if (Game.currentSettings.refillQueues)
                     {
                         PuzzleNode p = new PuzzleNode();
                         while (p.color == grid.queues[x, y][grid.queues[x, y].Count - 1].color)
                         {
                             p = new PuzzleNode();
                         }
                         grid.queues[x, y].Add(p);
                     }
                     else
                     {
                         grid.queues[x, y].Add(new PuzzleNode(Color.Gray));
                     }
                 }
                 for (int i = 0; i < grid.queues[x, y].Count; i++)
                 {
                     grid.queues[x, y][i].ClearMarking();
                 }
             }
             grid[x, y].ClearMarking();
         }
     }
 }
コード例 #21
0
 public static void UpdateToggleState(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].toggleOrb)
                 {
                     Color temp = box[x, y, z].color;
                     box[x, y, z].color       = box[x, y, z].toggleColor;
                     box[x, y, z].toggleColor = temp;
                 }
             }
         }
     }
 }
コード例 #22
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 // Clears state. Called when returning to ready state.
 public static void Clear(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 box[x, y, z].ClearMarking();
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             //if (x == 0 || x == gridSize-1 || y == 0 || y == gridSize-1)
             if(grid.queues[x,y]!=null)
             {
                 for (int i = 0; i < grid[x, y].replace_distance; i++)
                 {
                     grid.queues[x, y].RemoveAt(0);
                     if (Game.currentSettings.refillQueues)
                     {
                         PuzzleNode p = new PuzzleNode();
                         while (p.color == grid.queues[x, y][grid.queues[x, y].Count - 1].color)
                         {
                             p = new PuzzleNode();
                         }
                         grid.queues[x, y].Add(p);
                     }
                     else
                         grid.queues[x, y].Add(new PuzzleNode(Color.Gray));
                 }
                 for (int i = 0; i < grid.queues[x, y].Count; i++)
                 {
                     grid.queues[x, y][i].ClearMarking();
                 }
             }
             grid[x, y].ClearMarking();
         }
     }
 }
コード例 #23
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
        public static void LessonBonus(PuzzleBox box, MasterGrid grid)
        {
            introText = "" +
                        "We'll learn some advanced techniques soon,\n" +
                        "but matching bubbles like this is the core\n" +
                        "skill for any Jellyfish surgeon.:" +
                        "So let's practice this some more!\n" +
                        "Also, you can use the Right Control Stick at any\n" +
                        "time to shift the camera angle.:" +
                        "I like to set the camera so that all 27 bubbles\n" +
                        "in the body are visible at the same time.:" +
                        "But you should do whatever feels comfortable!\n" +
                        "Now, match those bubbles!";

            successText = "" +
                          "Way to go! You're getting the hang of it!\n" +
                          "Let's talk about some more advanced topics!";
            failureText = "BUG!";
            Clear(box, grid);
            restrictions         = ControlRestrictions.None;
            grid[2, 0]           = new PuzzleNode(Color.Red);
            grid[3, 0]           = new PuzzleNode(Color.Orange);
            grid[3, 4]           = new PuzzleNode(Color.Orange);
            grid.queues[3, 4][0] = new PuzzleNode(Game.jellyBlue);
            grid[0, 1]           = new PuzzleNode(Color.Magenta);
            grid.queues[3, 0][1] = new PuzzleNode(Game.jellyBlue);
            grid[1, 0]           = new PuzzleNode(Game.jellyBlue);
            grid[0, 2]           = new PuzzleNode(Color.Yellow);
            grid.queues[0, 2][0] = (new PuzzleNode(Color.Red));
            grid[4, 2]           = new PuzzleNode(Color.Green);
            grid[2, 4]           = new PuzzleNode(Color.Yellow);
            grid.queues[4, 2][0] = (new PuzzleNode(Color.Yellow));
            grid.queues[4, 2][1] = (new PuzzleNode(Color.Red));
            box[1, 1, 0]         = new PuzzleNode(Color.Red);
            box[1, 0, 2]         = new PuzzleNode(Color.Magenta);
            box[0, 2, 2]         = new PuzzleNode(Game.jellyBlue);
            box[0, 1, 2]         = new PuzzleNode(Color.Yellow);
            box[0, 0, 1]         = new PuzzleNode(Color.Green);
            box[2, 0, 0]         = new PuzzleNode(Color.Orange);
            box[2, 2, 2]         = new PuzzleNode(Color.Orange);
        }
コード例 #24
0
 public static bool AllGray(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].color != Color.Gray && box[x, y, z].color != Game.currentSettings.dangerColor)
                 {
                     return(false);
                 }
                 if (box[x, y, z].toggleColor != Color.Gray && box[x, y, z].toggleColor != Game.currentSettings.dangerColor)
                 {
                     return(false);
                 }
             }
         }
     }
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             if (grid.queues[x, y] != null)
             {
                 for (int i = 0; i < grid.queues[x, y].Count; i++)
                 {
                     if (grid.queues[x, y][i].color != Color.Gray && grid.queues[x, y][i].color != Game.currentSettings.dangerColor)
                     {
                         return(false);
                     }
                 }
             }
             if (grid[x, y].color != Color.Gray && grid[x, y].color != Game.currentSettings.dangerColor)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
コード例 #25
0
ファイル: MasterGrid.cs プロジェクト: kevincos/PuzzleBox
        public MasterGrid Copy()
        {
            MasterGrid newGrid = new MasterGrid();

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    newGrid[x, y] = arr[x, y].Copy();
                    if (queues[x, y] != null)
                    {
                        newGrid.queues[x, y] = new List <PuzzleNode>();
                        for (int z = 0; z < queues[x, y].Count; z++)
                        {
                            newGrid.queues[x, y].Add(queues[x, y][z].Copy());
                        }
                    }
                }
            }
            return(newGrid);
        }
コード例 #26
0
 public static void UpdateMoveCountdown(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].moveCountdownOrb)
                 {
                     box[x, y, z].countdown--;
                     if (box[x, y, z].countdown == 0)
                     {
                         box[x, y, z].moveCountdownOrb = false;
                         box[x, y, z].color            = Color.Gray;
                     }
                 }
             }
         }
     }
 }
コード例 #27
0
 public static void UpdateTimeCountdown(PuzzleBox box, MasterGrid grid, int elapsedTime)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].timeCountdownOrb)
                 {
                     box[x, y, z].countdown -= elapsedTime;
                     if (box[x, y, z].countdown <= 0)
                     {
                         box[x, y, z].timeCountdownOrb = false;
                         box[x, y, z].color            = Color.Gray;
                     }
                 }
             }
         }
     }
 }
コード例 #28
0
        // Completely randomizes the entire box and grid.
        public static void Reset(PuzzleBox box, MasterGrid grid)
        {
            for (int x = 0; x < boxSize; x++)
            {
                for (int y = 0; y < boxSize; y++)
                {
                    for (int z = 0; z < boxSize; z++)
                    {
                        //if (box[x, y, z].moveCountdownOrb == true) box[x, y, z].color = Color.Gray;
                        //if (box[x, y, z].timeCountdownOrb == true) box[x, y, z].color = Color.Gray;

                        box[x, y, z]        = new PuzzleNode();
                        box[x, y, z].marked = true;
                        //}
                    }
                }
            }
            Random r = new Random();

            for (int i = 0; i < Game.currentSettings.grayOrbStart;)
            {
                int x = r.Next(3);
                int y = r.Next(3);
                int z = r.Next(3);
                if (box[x, y, z].color != Color.Gray)
                {
                    box[x, y, z]        = new PuzzleNode(Color.Gray);
                    box[x, y, z].marked = true;
                    i++;
                }
            }
            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    grid[x, y]        = new PuzzleNode();
                    grid[x, y].marked = true;
                }
            }
        }
コード例 #29
0
        public static int GetMaxReplaceDistance(PuzzleBox box, MasterGrid grid)
        {
            AddBoxToGrid(box, grid);

            int max_distance = 0;

            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (IsWildCard(grid[x, y]) == true && max_distance == 0)
                    {
                        max_distance = 1;
                    }
                    if (grid[x, y].replace_distance > max_distance)
                    {
                        max_distance = grid[x, y].replace_distance;
                    }
                }
            }

            SetBoxFromGrid(box, grid);
            return(max_distance);
        }
コード例 #30
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson0(PuzzleBox box, MasterGrid grid)
 {
     Clear(box, grid);
     box[1, 2, 2] = new PuzzleNode(Color.Red);
     box[0, 2, 2] = new PuzzleNode(Color.Red);
     grid[3,0] = new PuzzleNode(Color.Red);
 }
コード例 #31
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Clear(PuzzleBox box, MasterGrid grid)
 {
     box.Blank();
     grid.Blank();
 }
コード例 #32
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson1(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 1;
     introText = "" +
     "Look at all these bubbles inside Mister\n"+
     "Jellyfish! The colored ones are toxic! Let's\n" +
     "see if we can get rid of them.:"+
     "You can use the Left Control Stick to rotate\n" +
     "the bubbles in Mister Jellyfish's body.\n" +
     "Try it now!:" +
     "Perfect! Try to match up the colored bubbles\n" +
     "in his body with the bubbles in his tentacles!";
     successText = "" +
     "Great job! When you aligned the bubbles in\n" +
     "his body with the bubbles in his tentacles,\n" +
     "the bubbles popped!";
     Clear(box, grid);
     restrictions = ControlRestrictions.StickOnly;
     grid[0, 1] = new PuzzleNode(Color.Yellow);
     grid[3, 4] = new PuzzleNode(Color.Green);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid.queues[0, 1][0] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][1] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta);
     grid[2, 4] = new PuzzleNode(Color.Orange);
     grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2] = new PuzzleNode(Color.Yellow);
     box[0, 0, 0] = new PuzzleNode(Color.Green);
     box[0, 1, 2] = new PuzzleNode(Color.Orange);
     box[0, 1, 0] = new PuzzleNode(Game.jellyBlue);
 }
コード例 #33
0
        // Checks if any valid move exists.
        public static bool HasValidMove(PuzzleBox box, MasterGrid grid)
        {
            List <Color> sideColorsBox1   = new List <Color>();
            List <Color> sideColorsBox2   = new List <Color>();
            List <Color> cornerColorsBox  = new List <Color>();
            List <Color> faceColorsBox    = new List <Color>();
            List <Color> sideColorsGrid   = new List <Color>();
            List <Color> cornerColorsGrid = new List <Color>();

            // Get potential box colors
            for (int x = 0; x < boxSize; x++)
            {
                for (int y = 0; y < boxSize; y++)
                {
                    for (int z = 0; z < boxSize; z++)
                    {
                        PuzzleNode p           = box[x, y, z];
                        int        centerCount = 0;
                        if (x == 1)
                        {
                            centerCount++;
                        }
                        if (y == 1)
                        {
                            centerCount++;
                        }
                        if (z == 1)
                        {
                            centerCount++;
                        }
                        if (centerCount == 0)
                        {
                            cornerColorsBox.Add(p.color);
                            if (p.toggleOrb)
                            {
                                cornerColorsBox.Add(p.toggleColor);
                            }
                        }
                        if (centerCount == 1)
                        {
                            sideColorsBox1.Add(p.color);
                            sideColorsBox2.Add(p.color);
                            if (p.toggleOrb)
                            {
                                sideColorsBox1.Add(p.toggleColor);
                                sideColorsBox2.Add(p.toggleColor);
                            }
                        }
                        if (centerCount == 2)
                        {
                            faceColorsBox.Add(p.color);
                            if (p.toggleOrb)
                            {
                                faceColorsBox.Add(p.toggleColor);
                            }
                        }
                    }
                }
            }
            // Get potential grid colors
            cornerColorsGrid.Add(grid[1, 0].color);
            if (grid[1, 0].toggleOrb)
            {
                cornerColorsGrid.Add(grid[1, 0].toggleColor);
            }
            cornerColorsGrid.Add(grid[3, 0].color);
            if (grid[3, 0].toggleOrb)
            {
                cornerColorsGrid.Add(grid[3, 0].toggleColor);
            }
            sideColorsGrid.Add(grid[2, 0].color);
            if (grid[2, 0].toggleOrb)
            {
                cornerColorsGrid.Add(grid[2, 0].toggleColor);
            }
            sideColorsGrid.Add(grid[2, 4].color);
            if (grid[2, 4].toggleOrb)
            {
                cornerColorsGrid.Add(grid[2, 4].toggleColor);
            }
            cornerColorsGrid.Add(grid[1, 4].color);
            if (grid[1, 4].toggleOrb)
            {
                cornerColorsGrid.Add(grid[1, 4].toggleColor);
            }
            cornerColorsGrid.Add(grid[3, 4].color);
            if (grid[3, 4].toggleOrb)
            {
                cornerColorsGrid.Add(grid[3, 4].toggleColor);
            }

            cornerColorsGrid.Add(grid[0, 1].color);
            if (grid[0, 1].toggleOrb)
            {
                cornerColorsGrid.Add(grid[0, 1].toggleColor);
            }
            cornerColorsGrid.Add(grid[0, 3].color);
            if (grid[0, 3].toggleOrb)
            {
                cornerColorsGrid.Add(grid[0, 3].toggleColor);
            }
            sideColorsGrid.Add(grid[0, 2].color);
            if (grid[0, 2].toggleOrb)
            {
                cornerColorsGrid.Add(grid[0, 2].toggleColor);
            }
            sideColorsGrid.Add(grid[4, 2].color);
            if (grid[4, 2].toggleOrb)
            {
                cornerColorsGrid.Add(grid[4, 2].toggleColor);
            }
            cornerColorsGrid.Add(grid[4, 1].color);
            if (grid[4, 1].toggleOrb)
            {
                cornerColorsGrid.Add(grid[4, 1].toggleColor);
            }
            cornerColorsGrid.Add(grid[4, 3].color);
            if (grid[4, 3].toggleOrb)
            {
                cornerColorsGrid.Add(grid[4, 3].toggleColor);
            }

            foreach (Color c in faceColorsBox)
            {
                if (c == Color.Gray || c == Game.currentSettings.dangerColor)
                {
                    continue;
                }
                if (sideColorsGrid.Contains(c))
                {
                    return(true);
                }
            }
            foreach (Color c in sideColorsBox1)
            {
                if (c == Color.Gray || c == Game.currentSettings.dangerColor)
                {
                    continue;
                }
                if (cornerColorsGrid.Contains(c) || sideColorsGrid.Contains(c))
                {
                    return(true);
                }
            }
            foreach (Color c in cornerColorsBox)
            {
                if (c == Color.Gray || c == Game.currentSettings.dangerColor)
                {
                    continue;
                }
                if (cornerColorsGrid.Contains(c))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #34
0
ファイル: Engine.cs プロジェクト: kevincos/PuzzleBox
 public void LoadTutorial(int tutorialStage)
 {
     newPuzzleBox = new PuzzleBox();
     newMasterGrid = new MasterGrid();
     newPuzzleBox.activeZ = 0;// puzzleBox.activeZ;
     newCubeDistance = 0;
     TutorialStage.LoadLesson(tutorialStage, newPuzzleBox, newMasterGrid);
     gameState = State.VANISH;
     puzzleBox.Mark();
     masterGrid.Mark();
     animateTime = 0;
 }
コード例 #35
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 public static void UpdateTimeCountdown(PuzzleBox box, MasterGrid grid, int elapsedTime)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].timeCountdownOrb)
                 {
                     box[x, y, z].countdown-=elapsedTime;
                     if (box[x, y, z].countdown <= 0)
                     {
                         box[x, y, z].timeCountdownOrb = false;
                         box[x, y, z].color = Color.Gray;
                     }
                 }
             }
         }
     }
 }
コード例 #36
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson6(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "Scoring big sets is tricky. Lets practice some\n" +
     "more. Try to match all of the bubbles using sets\n" +
     "of 3 or more!";
     successText = "" +
     "Awesome! These combos are worth way more points\n" +
     "than just matching two bubbles at a time.:" +
     "If you want to be a great Jellyfish doctor,\n" +
     "you'll need to master spotting when you can\n" +
     "match these kinds of sets!";
     failureText = "" +
     "Oops! Remember, you need to rotate the bubbles\n" +
     "so that all of the same colored bubbles are in\n" +
     "a straight line!:" +
     "Use the Right Control Stick to look around and\n" +
     "get a better view of things!:"+
     "Finally, don't forget about using the Shoulder\n" +
     "Buttons for rotations.";
     Clear(box,grid);
     restrictions = ControlRestrictions.None;
     grid[1, 0] = new PuzzleNode(Color.Green);
     grid[0, 2] = new PuzzleNode(Game.jellyBlue);
     grid[4, 3] = new PuzzleNode(Color.Yellow);
     box[2, 0, 2] = new PuzzleNode(Color.Green);
     box[2, 1, 2] = new PuzzleNode(Color.Green);
     box[2, 2, 2] = new PuzzleNode(Color.Green);
     box[1, 2, 0] = new PuzzleNode(Game.jellyBlue);
     box[1, 2, 1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2] = new PuzzleNode(Color.Yellow);
     box[0, 1, 2] = new PuzzleNode(Color.Yellow);
 }
コード例 #37
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
        private static PuzzleNode ReplaceHelper(int x, int y, MasterGrid grid)
        {
            PuzzleNode p = grid[x, y];
            if (IsWildCard(p))
            {
                p.replace_orb = new PuzzleNode(p.color);
                p.replace_distance = 0;
                p.replace_orb.bonus = 2;
            }
            else if (p.replace_bottom)
            {
                if (y + p.replace_distance < gridSize)
                    p.replace_orb = grid[x, y + p.replace_distance];
                else
                {
                    int queueDepth = y + p.replace_distance - gridSize;
                    if (queueDepth < grid.queues[x, gridSize-1].Count)
                        p.replace_orb = grid.queues[x, gridSize-1][queueDepth];
                    else
                        p.replace_orb = new PuzzleNode(Color.Black);
                }
            }
            else if (p.replace_top)
            {
                if (y - p.replace_distance >= 0)
                    p.replace_orb = grid[x, y - p.replace_distance];
                else
                {
                    int queueDepth = p.replace_distance - y - 1;
                    if (queueDepth < grid.queues[x, 0].Count)
                        p.replace_orb = grid.queues[x, 0][queueDepth];
                    else
                        p.replace_orb = new PuzzleNode(Color.Black);
                }
            }
            else if (p.replace_left)
            {
                if (x - p.replace_distance >= 0)
                    p.replace_orb = grid[x - p.replace_distance, y];
                else
                {
                    int queueDepth = p.replace_distance - x - 1;
                    if (queueDepth < grid.queues[0, y].Count)
                        p.replace_orb = grid.queues[0, y][queueDepth];
                    else
                        p.replace_orb = new PuzzleNode(Color.Black);
                }
            }
            else if (p.replace_right)
            {
                if (x + p.replace_distance < gridSize)
                    p.replace_orb = grid[x + p.replace_distance, y];
                else
                {
                    int queueDepth = x + p.replace_distance - gridSize;
                    if (queueDepth < grid.queues[gridSize-1, y].Count)
                        p.replace_orb = grid.queues[gridSize-1, y][queueDepth];
                    else
                        p.replace_orb = new PuzzleNode(Color.Black);
                }
            }
            else
            {
                p.replace_orb = new PuzzleNode(Color.Black);
            }

            p.replace_orb.replace_distance = p.replace_distance;
            p.replace_orb.replace_top = p.replace_top;
            p.replace_orb.replace_bottom = p.replace_bottom;
            p.replace_orb.replace_left = p.replace_left;
            p.replace_orb.replace_right = p.replace_right;
            if (p.replace_orb == null)
                p.replace_orb.bonus = 9;
            return p;
        }
コード例 #38
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson4(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "Now let's try and put it together! To match\n" +
     "these bubbles, you'll need to use the Left and\n" +
     "Right Triggers to push and pull them.:" +
     "But, you'll also need to use the Left Control\n" +
     "Stick and Shoulder Buttons to rotate them!:" +
     "Try and match all the bubbles!";
     successText = "" +
     "That's perfect!";
     failureText = "BUG!";
     Clear(box, grid);
     restrictions = ControlRestrictions.None;
     grid[0, 1] = new PuzzleNode(Color.Green);
     grid[2, 0] = new PuzzleNode(Color.Orange);
     grid[4, 2] = new PuzzleNode(Color.Magenta);
     grid[3, 4] = new PuzzleNode(Game.jellyBlue);
     grid[4, 1] = new PuzzleNode(Color.Yellow);
     grid[1, 4] = new PuzzleNode(Color.Red);
     box[0, 0, 0] = new PuzzleNode(Color.Red);
     box[2, 2, 2] = new PuzzleNode(Color.Yellow);
     box[1, 2, 2] = new PuzzleNode(Color.Magenta);
     box[0, 2, 0] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 1] = new PuzzleNode(Color.Green);
     box[2, 1, 1] = new PuzzleNode(Color.Orange);
 }
コード例 #39
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson5(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "This next lesson is tricky. Notice the two\n" +
     "yellow bubbles in Mister Jellyfish's body?:" +
     "They're right next to each other, but they\n" +
     "haven't popped!:" +
     "That's because to pop bubbles, you need to\n" +
     "match bubbles from the Jellyfish's body with\n" +
     "the bubbles in the tentacles.:" +
     "Try to align these two yellow bubbles with the\n" +
     "yellow bubble in the tentacle to form a\n"+
     "straight line.";
     successText = "" +
     "You got it. Remember, sets of bubbles will\n" +
     "only pop if they form a straight line. So be\n" +
     "careful!";
     failureText = "" +
     "Almost! Only sets of bubbles that form a\n" +
     "straight line will match.";
     Clear(box,grid);
     grid[0, 1] = new PuzzleNode(Color.Yellow);
     box[0, 2, 2] = new PuzzleNode(Color.Yellow);
     box[0, 2, 1] = new PuzzleNode(Color.Yellow);
     restrictions = ControlRestrictions.None;
 }
コード例 #40
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson3(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 0;
     introText = "" +
     "In addition, you can use the Left and Right\n" +
     "Triggers to push and pull the bubbles in the\n" +
     "Jellyfish's body. Try it now!:" +
     "Great! That way, you can change which layer of\n" +
     "bubbles aligns with the tentacles.:" +
     "Now, use the Left and Right Triggers to match\n"+
     "the bubbles!";
     successText = "" +
     "Great! With the Left Control Stick, Shoulder\n" +
     "Buttons, and Triggers, you can reorient the\n" +
     "bubbles however you want!:"+
     "If you need a reminder of the controls, take a\n" +
     "look around the top and bottom left of the\n"+
     "screen for a review.";
     Clear(box, grid);
     restrictions = ControlRestrictions.TriggersOnly;
     grid[0, 1] = new PuzzleNode(Color.Red);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid[3, 0] = new PuzzleNode(Color.Yellow);
     grid[4, 3] = new PuzzleNode(Game.jellyBlue);
     grid[1, 4] = new PuzzleNode(Color.Green);
     box[0, 0, 0] = new PuzzleNode(Color.Magenta);
     box[1, 0, 0] = new PuzzleNode(Color.Red);
     box[2, 2, 0] = new PuzzleNode(Color.Green);
     box[1, 0, 2] = new PuzzleNode(Color.Yellow);
     box[2, 2, 2] = new PuzzleNode(Game.jellyBlue);
 }
コード例 #41
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson2(PuzzleBox box, MasterGrid grid)
 {
     controlLessonIndex = 0;
     introText = "" +
     "Instead of using the Left Control Stick, you\n" +
     "can use the Left and Right Shoulder Buttons.\n" +
     "Try it now!:" +
     "Good! This will perform a different type of\n" +
     "rotation. Use the Shoulder Buttons to match\n" +
     "these bubbles!";
     successText = "" +
     "Nice! If you can master all 6 types of these\n" +
     "rotations, you'll do great!";
     restrictions = ControlRestrictions.ShouldersOnly;
     Clear(box,grid);
     grid[0, 1] = new PuzzleNode(Color.Yellow);
     grid[3, 4] = new PuzzleNode(Color.Green);
     grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta);
     grid.queues[0, 1][0] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][1] = new PuzzleNode(Color.Red);
     grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta);
     grid[2, 4] = new PuzzleNode(Color.Orange);
     grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue);
     box[0, 0, 2] = new PuzzleNode(Color.Yellow);
     box[0, 0, 0] = new PuzzleNode(Color.Green);
     box[0, 1, 2] = new PuzzleNode(Color.Orange);
     box[0, 1, 0] = new PuzzleNode(Game.jellyBlue);
 }
コード例 #42
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 private static void AddBoxToGrid(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             grid[x + boxOffset, y + boxOffset] = box[box.activeZ, y, x];
         }
     }
 }
コード例 #43
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
        public static void UpdateToggleState(PuzzleBox box, MasterGrid grid)
        {
            for (int x = 0; x < boxSize; x++)
            {
                for (int y = 0; y < boxSize; y++)
                {
                    for (int z = 0; z < boxSize; z++)
                    {
                        if (box[x, y, z].toggleOrb)
                        {
                            Color temp = box[x, y, z].color;
                            box[x, y, z].color = box[x, y, z].toggleColor;
                            box[x, y, z].toggleColor = temp;

                        }
                    }
                }
            }
        }
コード例 #44
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 private static void SetBoxFromGrid(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             box[box.activeZ, y, x] = grid[x + boxOffset, y + boxOffset];
         }
     }
 }
コード例 #45
0
        private static PuzzleNode ReplaceHelper(int x, int y, MasterGrid grid)
        {
            PuzzleNode p = grid[x, y];

            if (IsWildCard(p))
            {
                p.replace_orb       = new PuzzleNode(p.color);
                p.replace_distance  = 0;
                p.replace_orb.bonus = 2;
            }
            else if (p.replace_bottom)
            {
                if (y + p.replace_distance < gridSize)
                {
                    p.replace_orb = grid[x, y + p.replace_distance];
                }
                else
                {
                    int queueDepth = y + p.replace_distance - gridSize;
                    if (queueDepth < grid.queues[x, gridSize - 1].Count)
                    {
                        p.replace_orb = grid.queues[x, gridSize - 1][queueDepth];
                    }
                    else
                    {
                        p.replace_orb = new PuzzleNode(Color.Black);
                    }
                }
            }
            else if (p.replace_top)
            {
                if (y - p.replace_distance >= 0)
                {
                    p.replace_orb = grid[x, y - p.replace_distance];
                }
                else
                {
                    int queueDepth = p.replace_distance - y - 1;
                    if (queueDepth < grid.queues[x, 0].Count)
                    {
                        p.replace_orb = grid.queues[x, 0][queueDepth];
                    }
                    else
                    {
                        p.replace_orb = new PuzzleNode(Color.Black);
                    }
                }
            }
            else if (p.replace_left)
            {
                if (x - p.replace_distance >= 0)
                {
                    p.replace_orb = grid[x - p.replace_distance, y];
                }
                else
                {
                    int queueDepth = p.replace_distance - x - 1;
                    if (queueDepth < grid.queues[0, y].Count)
                    {
                        p.replace_orb = grid.queues[0, y][queueDepth];
                    }
                    else
                    {
                        p.replace_orb = new PuzzleNode(Color.Black);
                    }
                }
            }
            else if (p.replace_right)
            {
                if (x + p.replace_distance < gridSize)
                {
                    p.replace_orb = grid[x + p.replace_distance, y];
                }
                else
                {
                    int queueDepth = x + p.replace_distance - gridSize;
                    if (queueDepth < grid.queues[gridSize - 1, y].Count)
                    {
                        p.replace_orb = grid.queues[gridSize - 1, y][queueDepth];
                    }
                    else
                    {
                        p.replace_orb = new PuzzleNode(Color.Black);
                    }
                }
            }
            else
            {
                p.replace_orb = new PuzzleNode(Color.Black);
            }

            p.replace_orb.replace_distance = p.replace_distance;
            p.replace_orb.replace_top      = p.replace_top;
            p.replace_orb.replace_bottom   = p.replace_bottom;
            p.replace_orb.replace_left     = p.replace_left;
            p.replace_orb.replace_right    = p.replace_right;
            if (p.replace_orb == null)
            {
                p.replace_orb.bonus = 9;
            }
            return(p);
        }
コード例 #46
0
ファイル: Matcher.cs プロジェクト: kevincos/PuzzleBox
 public static void UpdateMoveCountdown(PuzzleBox box, MasterGrid grid)
 {
     for (int x = 0; x < boxSize; x++)
     {
         for (int y = 0; y < boxSize; y++)
         {
             for (int z = 0; z < boxSize; z++)
             {
                 if (box[x, y, z].moveCountdownOrb)
                 {
                     box[x, y, z].countdown--;
                     if (box[x, y, z].countdown == 0)
                     {
                         box[x, y, z].moveCountdownOrb = false;
                         box[x, y, z].color = Color.Gray;
                     }
                 }
             }
         }
     }
 }
コード例 #47
0
        //Identifies all scoring matches and marks them.
        public static List <ScoringSet> Solve(PuzzleBox box, MasterGrid grid)
        {
            Matcher.AddBoxToGrid(box, grid);

            List <ScoringSet> scoringSets = new List <ScoringSet>();

            // Marking orbs
            #region InitialOrbMarking
            // Marking vertical lines
            for (int x = boxOffset; x < boxOffset + boxSize; x++)
            {
                int        start_index = 0;
                int        end_index   = 0;
                PuzzleNode lastNode    = new PuzzleNode(Color.Black);
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid[x, y] == null)
                    {
                        continue;
                    }
                    if (PuzzleNode.Match(lastNode, grid[x, y]))
                    {
                        lastNode = grid[x, y];
                        end_index++;
                    }
                    else
                    {
                        lastNode = grid[x, y];
                        if (StartEndHelper(start_index, end_index))
                        {
                            ScoringSet s;
                            if (start_index < boxOffset)
                            {
                                s = CreateScoreHelperVert(start_index, end_index, x, grid[x, start_index]);
                            }
                            else
                            {
                                s = CreateScoreHelperVert(start_index, end_index, x, grid[x, y]);
                            }
                            for (int i = start_index; i < end_index; i++)
                            {
                                s.multiplier *= grid[x, i].bonus;
                                MarkHelperVert(start_index, end_index, i, grid[x, i]);
                            }
                            scoringSets.Add(s);
                        }
                        start_index = y;
                        end_index   = y + 1;
                    }
                }
                if (StartEndHelper(start_index, end_index))
                {
                    ScoringSet s = CreateScoreHelperVert(start_index, end_index, x, grid[x, end_index - 1]);
                    for (int i = start_index; i < end_index; i++)
                    {
                        s.multiplier *= grid[x, i].bonus;
                        MarkHelperVert(start_index, end_index, i, grid[x, i]);
                    }
                    scoringSets.Add(s);
                }
            }

            // Marking horizontal lines
            for (int y = boxOffset; y < boxOffset + boxSize; y++)
            {
                int        start_index = 0;
                int        end_index   = 0;
                PuzzleNode lastNode    = new PuzzleNode(Color.Black);
                for (int x = 0; x < gridSize; x++)
                {
                    if (grid[x, y] == null)
                    {
                        continue;
                    }
                    if (PuzzleNode.Match(lastNode, grid[x, y]))
                    {
                        lastNode = grid[x, y];
                        end_index++;
                    }
                    else
                    {
                        lastNode = grid[x, y];
                        if (StartEndHelper(start_index, end_index))
                        {
                            ScoringSet s;
                            if (start_index < boxOffset)
                            {
                                s = CreateScoreHelperHoriz(start_index, end_index, y, grid[start_index, y]);
                            }
                            else
                            {
                                s = CreateScoreHelperHoriz(start_index, end_index, y, grid[x, y]);
                            }
                            for (int i = start_index; i < end_index; i++)
                            {
                                s.multiplier *= grid[i, y].bonus;
                                MarkHelperHoriz(start_index, end_index, i, grid[i, y]);
                            }
                            scoringSets.Add(s);
                        }
                        start_index = x;
                        end_index   = x + 1;
                    }
                }
                if (StartEndHelper(start_index, end_index))
                {
                    ScoringSet s = CreateScoreHelperHoriz(start_index, end_index, y, grid[end_index - 1, y]);

                    for (int i = start_index; i < end_index; i++)
                    {
                        s.multiplier *= grid[i, y].bonus;
                        MarkHelperHoriz(start_index, end_index, i, grid[i, y]);
                    }
                    scoringSets.Add(s);
                }
            }
            #endregion

            // Extend wildcard markings
            #region ExtendWildcardMarkings
            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (IsWildCard(grid[x, y]))
                    {
                        for (int i = x + 1; i < gridSize; i++)
                        {
                            if (grid[i, y].marked)
                            {
                                grid[i, y].replace_right = true;
                            }
                            else
                            {
                                break;
                            }
                        }
                        for (int i = x - 1; i >= 0; i--)
                        {
                            if (grid[i, y].marked)
                            {
                                grid[i, y].replace_left = true;
                            }
                            else
                            {
                                break;
                            }
                        }
                        for (int i = y + 1; i < gridSize; i++)
                        {
                            if (grid[x, i].marked)
                            {
                                grid[x, i].replace_bottom = true;
                            }
                            else
                            {
                                break;
                            }
                        }
                        for (int i = y - 1; i >= 0; i--)
                        {
                            if (grid[x, i].marked)
                            {
                                grid[x, i].replace_top = true;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }
            #endregion

            // Mark non-scoring orbs as needing to be replaced
            #region MarkNonScoringOrbsForReplacement
            for (int x = boxOffset; x < boxOffset + boxSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (grid[x, y].replace_bottom && !IsWildCard(grid[x, y]))
                    {
                        for (int i = y; i < gridSize; i++)
                        {
                            grid[x, i].marked           = true;
                            grid[x, i].replace_bottom   = true;
                            grid[x, i].replace_distance = grid[x, y].replace_distance;
                        }
                        break;
                    }
                }
                for (int y = gridSize - 1; y >= 0; y--)
                {
                    if (grid[x, y].replace_top && !IsWildCard(grid[x, y]))
                    {
                        for (int i = y; i >= 0; i--)
                        {
                            grid[x, i].marked           = true;
                            grid[x, i].replace_top      = true;
                            grid[x, i].replace_distance = grid[x, y].replace_distance;
                        }
                        break;
                    }
                }
            }
            for (int y = boxOffset; y < boxOffset + boxSize; y++)
            {
                for (int x = 0; x < gridSize; x++)
                {
                    if (grid[x, y].replace_right && !IsWildCard(grid[x, y]))
                    {
                        for (int i = x; i < gridSize; i++)
                        {
                            grid[i, y].marked           = true;
                            grid[i, y].replace_right    = true;
                            grid[i, y].replace_distance = grid[x, y].replace_distance;
                        }
                        break;
                    }
                }
                for (int x = gridSize - 1; x >= 0; x--)
                {
                    if (grid[x, y].replace_left && !IsWildCard(grid[x, y]))
                    {
                        for (int i = x; i >= 0; i--)
                        {
                            grid[i, y].marked           = true;
                            grid[i, y].replace_left     = true;
                            grid[i, y].replace_distance = grid[x, y].replace_distance;
                        }
                        break;
                    }
                }
            }
            #endregion

            // fix replace distances
            #region FixReplaceDistances
            for (int x = 0; x < gridSize; x++)
            {
                for (int y = 0; y < gridSize; y++)
                {
                    if (IsWildCard(grid[x, y]))
                    {
                        if (grid[x, y].replace_right)
                        {
                            for (int i = x; i < gridSize; i++)
                            {
                                if (grid[i, y].marked)
                                {
                                    grid[i, y].replace_distance--;
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        if (grid[x, y].replace_left)
                        {
                            for (int i = x; i >= 0; i--)
                            {
                                if (grid[i, y].marked)
                                {
                                    grid[i, y].replace_distance--;
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        if (grid[x, y].replace_bottom)
                        {
                            for (int i = y; i < gridSize; i++)
                            {
                                if (grid[x, i].marked)
                                {
                                    grid[x, i].replace_distance--;
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        if (grid[x, y].replace_top)
                        {
                            for (int i = y; i >= 0; i--)
                            {
                                if (grid[x, i].marked)
                                {
                                    grid[x, i].replace_distance--;
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            #endregion

            Matcher.SetBoxFromGrid(box, grid);
            return(scoringSets);
        }
コード例 #48
0
ファイル: Engine.cs プロジェクト: kevincos/PuzzleBox
        public Engine(int tutorialStage)
        {
            ApplyResolutionChanges();
            Logger.ClearLogger();
            automator = new Random();
            cubeDistance = 0;
            cubeDistanceGoal = 0;
            if (Game.currentSettings.displayTimer && Game.currentSettings.countdownTimer)
            {
                timer = new Countdown(Game.currentSettings.initialTime, Game.screenSizeX - 200, Game.screenSizeY - 100);
                timer.enabled = true;
                clock.enabled = false;
            }
            else if (Game.currentSettings.displayTimer && Game.currentSettings.countdownTimer != true)
            {
                clock = new Countup(0, Game.screenSizeX - 200, Game.screenSizeY - 100);
                clock.enabled = true;
                timer.enabled = false;

            }
            else
            {
                timer.enabled = false;
                clock.enabled = false;
            }

            targetShift = new Vector2(1000, 1000);
            savedShift = new Vector2(1000, 1000);
            shift = new Vector2(1000, 1000);

            puzzleBox = new PuzzleBox();
            masterGrid = new MasterGrid();

            fragmentList = new List<Fragment>();
            scoreList = new List<ScoringSet>();
            if (Game.currentSettings.randomOrbs)
            {
                Matcher.Reset(puzzleBox, masterGrid);
                Matcher.Clear(puzzleBox, masterGrid);
                gameState = State.RESUMING;
                //MusicControl.PlayGameMusic();
            }
            else if (tutorialStage!=-1)
            {
                TutorialStage.LoadLesson(tutorialStage, puzzleBox, masterGrid);
                gameState = State.RESUMING;
            }
            else
            {
                LevelLoader.LoadLevel(Game.currentSettings.levelfilename, puzzleBox, masterGrid);
                gameState = State.RESUMING;
            }
            animateTime = 0;
        }
コード例 #49
0
ファイル: Engine.cs プロジェクト: kevincos/PuzzleBox
 public void Back()
 {
     if (mode != ControlMode.EDITOR)
     {
         //puzzleBox = prevPuzzleBox.Copy();
         //masterGrid = prevMasterGrid.Copy();
         newPuzzleBox = prevPuzzleBox.Copy();
         newMasterGrid = prevMasterGrid.Copy();
         puzzleBox.Mark();
         masterGrid.Mark();
         newCubeDistance = prevCubeDistance;
         //gameState = State.NEWSET;
         pendingResult = GameStopCause.NONE;
         gameState = State.VANISH;
         animateTime = 0;
         prevPuzzleBox = null;
         prevMasterGrid = null;
     }
 }
コード例 #50
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 //Puzzle Load
 public static void LoadLesson(int index, PuzzleBox box, MasterGrid grid)
 {
     active = true;
     introIndex = 0;
     successIndex = 0;
     failureIndex = 0;
     controlLessonIndex = -5;
     phase = TutorialPhase.Intro;
     switch (index)
     {
         case(0):
             Lesson1(box, grid);
             break;
         case(1):
             Lesson2(box, grid);
             break;
         case (2):
             Lesson3(box, grid);
             break;
         case (3):
             Lesson4(box, grid);
             break;
         case (4):
             LessonBonus(box, grid);
             break;
         case (5):
             Lesson5(box, grid);
             break;
         case (6):
             Lesson6(box, grid);
             break;
         case (7):
             Lesson7(box, grid);
             break;
         case (8):
             Lesson8(box, grid);
             break;
         case (9):
             Lesson9(box, grid);
             break;
         case (10):
             Lesson10(box, grid);
             break;
         default:
             return;
     }
     if (loaded == true)
     {
         Mark(box, grid);
     }
     else
         loaded = true;
 }
コード例 #51
0
ファイル: Engine.cs プロジェクト: kevincos/PuzzleBox
        public GameStopCause Update(GameTime gameTime)
        {
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0) cooldown = 0;
            if (mode != ControlMode.EDITOR)
            {
                Matcher.UpdateTimeCountdown(puzzleBox, masterGrid, gameTime.ElapsedGameTime.Milliseconds);
                if (false == timer.Update(gameTime))
                {
                    Logger.totalScore = currentScore;
                    Logger.LogGame();
                    return GameStopCause.END;
                }
                clock.Update(gameTime);
            }
            // Game state flow
            if (gameState == State.DESTROY || gameState == State.VANISH || gameState == State.NEWSET)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > maxAnimateTime)
                    animateTime = maxAnimateTime;
            }
            if (gameState == State.PAUSING || gameState == State.RESUMING)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > 2*maxAnimateTime)
                    animateTime = 2*maxAnimateTime;
            }
            if (gameState == State.REGENERATE)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > maxAnimateTime * maxSlideDistance)
                    animateTime = maxAnimateTime * maxSlideDistance;
            }
            if (gameState == State.MOVECOMPLETE)
            {
                if (mode == ControlMode.EDITOR) gameState = State.READY;
                else
                {
                    if(Game.currentSettings.mode==GameMode.MoveChallenge)
                        movesRemaining--;
                    Matcher.UpdateToggleState(puzzleBox, masterGrid);
                    gameState = State.VERIFY;
                }
            }
            if (gameState == State.VERIFY)
            {
                List<ScoringSet> scoreSet = Matcher.Solve(puzzleBox, masterGrid);
                if (scoreSet.Count > 0)
                    SoundEffects.PlayScore();
                foreach (ScoringSet s in scoreSet)
                {
                    if (Game.currentSettings.loseType == LoseType.BADCOLOR)
                    {
                        if (s.color == Game.currentSettings.dangerColor)
                            pendingResult = GameStopCause.LOSE_ERROR;
                    }
                    s.CalculateScore();
                    s.LogScore();
                    currentScore += s.score;
                    scoreList.Add(s);
                }
                if (Matcher.AllGray(puzzleBox, masterGrid))
                {
                    if (Game.currentSettings.mode == GameMode.Tutorial)
                    {
                        TutorialStage.phase = TutorialPhase.Pass;
                        return GameStopCause.TUTORIAL_PASS;
                    }
                    return GameStopCause.WIN;
                }
                maxSlideDistance = Matcher.GetMaxReplaceDistance(puzzleBox, masterGrid);
                if (0 == maxSlideDistance)
                {
                    if (movesRemaining == 0)
                        return GameStopCause.END;

                    if (!Matcher.HasValidMove(puzzleBox, masterGrid))
                    {
                        if (Game.currentSettings.mode == GameMode.Puzzle)
                        {
                            return GameStopCause.LOSE_STUCK;
                        }
                        else if (Game.currentSettings.mode == GameMode.Tutorial)
                        {
                            return GameStopCause.TUTORIAL_FAIL;
                        }
                        else
                        {
                            newPuzzleBox = new PuzzleBox();
                            newMasterGrid = new MasterGrid();
                            Matcher.Reset(newPuzzleBox, newMasterGrid);
                            newPuzzleBox.activeZ = puzzleBox.activeZ;
                            newCubeDistance = cubeDistance;
                            gameState = State.VANISH;
                            puzzleBox.Mark();
                            masterGrid.Mark();
                            animateTime = 0;
                        }
                    }
                    else
                    {
                        Matcher.UpdateMoveCountdown(puzzleBox, masterGrid);
                        gameState = State.READY;
                        animateTime = 0;
                    }
                }
                else
                {
                    gameState = State.DESTROY;
                    animateTime = 0;
                }
            }
            if (gameState == State.DESTROY && animateTime == maxAnimateTime)
            {
                if (pendingResult != GameStopCause.NONE)
                    return pendingResult;
                for (int x = 0; x < gridSize; x++)
                {
                    for (int y = 0; y < gridSize; y++)
                    {
                        if (masterGrid[x, y].marked)
                        {
                            fragmentList.Add(new Fragment(masterGrid[x, y].screenX, masterGrid[x, y].screenY, Game.screenSizeX, Game.screenSizeY, masterGrid[x, y].scale, masterGrid[x, y].color));
                        }
                    }
                }
                for (int y = 0; y < boxSize; y++)
                {
                    for (int z = 0; z < boxSize; z++)
                    {
                        if (puzzleBox[0, y, z].marked)
                        {
                            fragmentList.Add(new Fragment(puzzleBox[0, y, z].screenX, puzzleBox[0, y, z].screenY, Game.screenSizeX, Game.screenSizeY, puzzleBox[0, y, z].scale, puzzleBox[0, y, z].color));
                        }
                    }
                }
                // Regenerate orbs
                Matcher.Replace(puzzleBox, masterGrid);
                gameState = State.REGENERATE;
                animateTime = 0;
            }
            if (gameState == State.PAUSING && animateTime == 2 * maxAnimateTime)
            {
                gameState = State.RESUMING;
                animateTime = 0;
                SoundEffects.PlayMove();
                return GameStopCause.PAUSE;
            }
            if (gameState == State.RESUMING && animateTime == 2 * maxAnimateTime)
            {
                //Matcher.Reset(puzzleBox,masterGrid);
                Matcher.Clear(puzzleBox, masterGrid);
                gameState = State.READY;
                animateTime = 0;
                if (Game.currentSettings.mode == GameMode.Tutorial && firstResume == true)
                {
                    firstResume = false;
                    return GameStopCause.TUTORIAL_TEXT;
                }
            }
            if (gameState == State.VANISH && animateTime == maxAnimateTime)
            {
                if (newPuzzleBox != null)
                {
                    puzzleBox = newPuzzleBox.Copy();
                    masterGrid = newMasterGrid.Copy();
                    cubeDistance = newCubeDistance;
                    newPuzzleBox = null;
                    newMasterGrid = null;
                }
                gameState = State.NEWSET;
                animateTime = 0;
            }
            if (gameState == State.NEWSET && animateTime == maxAnimateTime)
            {
                Matcher.Clear(puzzleBox, masterGrid);
                gameState = State.READY;
                animateTime = 0;
                if (Game.currentSettings.mode == GameMode.Tutorial && firstResume==true)
                {
                    firstResume = false;
                    return GameStopCause.TUTORIAL_TEXT;
                }
            }
            if (gameState == State.REGENERATE && animateTime == maxAnimateTime * maxSlideDistance)
            {
                // Clear orbs
                Matcher.Clear(puzzleBox, masterGrid);
                gameState = State.VERIFY;
            }

            if (gameState == State.READY)
            {
                if(mode!=ControlMode.EDITOR)
                    Matcher.UpdateTimeCountdown(puzzleBox, masterGrid, gameTime.ElapsedGameTime.Milliseconds);
                if (mode == ControlMode.NORMAL)
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.P) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.Start))
                    {
                        gameState = State.PAUSING;
                        savedShift = shift;
                        animateTime = 0;
                    }
                }
                if (mode == ControlMode.NORMAL || mode == ControlMode.EDITOR)
                {
                    Vector2 stick = GamePad.GetState(Game.playerIndex).ThumbSticks.Left;
                    GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                    //if (gamePadState.IsConnected == false)
                    //{
                        //gameState = State.PAUSING;
                        //animateTime = 0;
                    //}
                    if (Keyboard.GetState().IsKeyDown(Keys.B) || gamePadState.IsButtonDown(Buttons.B))
                    {
                        if (Game.currentSettings.mode == GameMode.Puzzle)
                        {
                            if (prevPuzzleBox == null)
                                SoundEffects.PlayClick();
                            else
                            {
                                SoundEffects.PlayScore();
                                Back();
                            }
                        }
                    }
                    if ((Keyboard.GetState().IsKeyDown(Keys.E) || gamePadState.IsButtonDown(Buttons.Y)))
                    {
                        if (cooldown == 0)
                        {
                            Game.gameSettings.soundEffectsEnabled = !Game.gameSettings.soundEffectsEnabled;
                            cooldown = 250;
                        }
                    }
                    if (cooldown==0 && (Keyboard.GetState().IsKeyDown(Keys.M) || gamePadState.IsButtonDown(Buttons.X)))
                    {
                        if (Game.gameSettings.musicEnabled)
                        {
                            Game.gameSettings.musicEnabled = false;
                            MusicControl.Stop();
                        }
                        else
                        {
                            Game.gameSettings.musicEnabled = true;
                            if (Game.currentSettings.mode == GameMode.Tutorial)
                                MusicControl.PlayMenuMusic();
                            else
                                MusicControl.PlayGameMusic();
                        }
                        cooldown = 250;
                    }
                    if(cooldown==0 && (Keyboard.GetState().IsKeyDown(Keys.OemPlus) || gamePadState.IsButtonDown(Buttons.Back)))
                    {
                        Game.gameSettings.displayControls = !Game.gameSettings.displayControls;
                        cooldown = 250;
                    }
                    if ((TutorialStage.phase == TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.StickOnly))
                    {
                        if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || stick.X < -Game.gameSettings.controlStickTrigger)
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATEPOSY;
                        }
                        if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || stick.X > Game.gameSettings.controlStickTrigger)
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATENEGY;
                        }
                        if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || stick.Y > Game.gameSettings.controlStickTrigger)
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATEPOSX;
                        }
                        if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || stick.Y < -Game.gameSettings.controlStickTrigger)
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATENEGX;
                        }
                    }
                    if (TutorialStage.phase==TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.ShouldersOnly)
                    {
                        if (Keyboard.GetState().IsKeyDown(Keys.S) || gamePadState.IsButtonDown(Buttons.RightShoulder))
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATEPOSZ;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.A) || gamePadState.IsButtonDown(Buttons.LeftShoulder))
                        {
                            SoundEffects.PlayMove();
                            prevMasterGrid = masterGrid.Copy();
                            prevPuzzleBox = puzzleBox.Copy();
                            prevCubeDistance = cubeDistance;
                            gameState = State.ROTATENEGZ;
                        }
                    }
                    if (TutorialStage.phase == TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.TriggersOnly)
                    {
                        if (Keyboard.GetState().IsKeyDown(Keys.Q) || gamePadState.IsButtonDown(Buttons.LeftTrigger) || gamePadState.IsButtonDown(Buttons.LeftTrigger))
                        {
                            if (cubeDistance < spacing * 2)
                            {
                                SoundEffects.PlayMove();
                                prevMasterGrid = masterGrid.Copy();
                                prevPuzzleBox = puzzleBox.Copy();
                                prevCubeDistance = cubeDistance;
                                cubeDistanceGoal = cubeDistance + spacing;
                                gameState = State.PUSH;
                            }
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.W) || gamePadState.IsButtonDown(Buttons.RightTrigger) || gamePadState.IsButtonDown(Buttons.RightTrigger))
                        {
                            if (cubeDistance > 0)
                            {
                                SoundEffects.PlayMove();
                                prevMasterGrid = masterGrid.Copy();
                                prevPuzzleBox = puzzleBox.Copy();
                                prevCubeDistance = cubeDistance;
                                cubeDistanceGoal = cubeDistance - spacing;
                                gameState = State.PULL;
                            }
                        }
                    }
                }
                if (mode == ControlMode.AUTOMATED)
                {
                    int x = automator.Next(0, 8);
                    if (x == 0) gameState = State.ROTATEPOSY;
                    if (x == 1) gameState = State.ROTATEPOSZ;
                    if (x == 2) gameState = State.ROTATEPOSX;
                    if (x == 3) gameState = State.ROTATENEGX;
                    if (x == 4) gameState = State.ROTATENEGY;
                    if (x == 5) gameState = State.ROTATENEGZ;
                    if (x == 6)
                    {
                        if (cubeDistance > 0)
                        {
                            cubeDistanceGoal = cubeDistance - spacing;
                            gameState = State.PULL;
                        }
                    }
                    if (x == 7)
                    {
                        if (cubeDistance < spacing * 2)
                        {
                            cubeDistanceGoal = cubeDistance + spacing;
                            gameState = State.PUSH;
                        }
                    }
                }
                if (mode == ControlMode.EDITOR)
                {
                    editorCooldown-=gameTime.ElapsedGameTime.Milliseconds;
                    if (editorCooldown < 0) editorCooldown = 0;
                    if (editorCooldown == 0)
                    {
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad1))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 2, 0];
                            selectedQueue = null;
                            selectedNode.selected = true;

                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad2))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 2, 1];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad3))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 2, 2];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad4))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 1, 0];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad5))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 1, 1];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad6))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 1, 2];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad7))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 0, 0];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad8))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 0, 1];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.NumPad9))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = puzzleBox[puzzleBox.activeZ, 0, 2];
                            selectedQueue = null;
                            selectedNode.selected = true;
                        }

                        if (Keyboard.GetState().IsKeyDown(Keys.Insert))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[1, 0];
                            selectedQueue = masterGrid.queues[1, 0]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.Home))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[2, 0];
                            selectedQueue = masterGrid.queues[2, 0]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.PageUp))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[3, 0];
                            selectedQueue = masterGrid.queues[3, 0]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.Delete))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[1, 4];
                            selectedQueue = masterGrid.queues[1, 4]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.End))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[2, 4];
                            selectedQueue = masterGrid.queues[2, 4]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.PageDown))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[3, 4];
                            selectedQueue = masterGrid.queues[3, 4]; ;
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemCloseBrackets))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[4, 1];
                            selectedQueue = masterGrid.queues[4, 1];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemQuotes))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[4, 2];
                            selectedQueue = masterGrid.queues[4, 2];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemQuestion))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[4, 3];
                            selectedQueue = masterGrid.queues[4, 3];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemOpenBrackets))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[0, 1];
                            selectedQueue = masterGrid.queues[0,1];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemSemicolon))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[0, 2];
                            selectedQueue = masterGrid.queues[0, 2];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemPeriod))
                        {
                            puzzleBox.ClearSelection();
                            masterGrid.ClearSelection();
                            selectedNode = masterGrid[0, 3];
                            selectedQueue = masterGrid.queues[0, 3];
                            selectedNode.selected = true;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.M))
                        {
                            if (selectedQueue != null)
                            {
                                puzzleBox.ClearSelection();
                                masterGrid.ClearSelection();
                                selectedDepth++;
                                if (selectedDepth >= selectedQueue.Count)
                                    selectedDepth = selectedQueue.Count - 1;
                                selectedNode = selectedQueue[selectedDepth];
                                selectedNode.selected = true;
                                editorCooldown = 250;
                            }
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.N))
                        {
                            if (selectedQueue != null)
                            {
                                puzzleBox.ClearSelection();
                                masterGrid.ClearSelection();
                                selectedDepth--;
                                if (selectedDepth < 0) selectedDepth = 0;
                                selectedNode = selectedQueue[selectedDepth];
                                selectedNode.selected = true;
                                editorCooldown = 250;
                            }
                        }

                        if (Keyboard.GetState().IsKeyDown(Keys.R))
                        {
                            selectedNode.color = Color.Red;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.G))
                        {
                            selectedNode.color = Color.Green;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.B))
                        {
                            selectedNode.color = Game.jellyBlue;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.Y))
                        {
                            selectedNode.color = Color.Yellow;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.P))
                        {
                            selectedNode.color = Color.Magenta;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.O))
                        {
                            selectedNode.color = Color.DarkOrange;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.X))
                        {
                            selectedNode.color = Color.Gray;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.F10))
                        {
                            LevelLoader.SaveLevel(puzzleBox, masterGrid);
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.F5))
                        {
                            mode = ControlMode.NORMAL;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.F))
                        {
                            if (selectedNode.toggleOrb == false)
                            {
                                selectedNode.toggleColor = Color.Gray;
                            }
                            selectedNode.toggleOrb = true;
                        }

                        if (Keyboard.GetState().IsKeyDown(Keys.C))
                        {
                            if (selectedNode.moveCountdownOrb == false)
                            {
                                selectedNode.moveCountdownOrb = true;
                                selectedNode.countdown = 10;
                            }
                            else
                                selectedNode.moveCountdownOrb = false;
                        }
                        if(Keyboard.GetState().IsKeyDown(Keys.LeftShift)) {
                            if(Keyboard.GetState().IsKeyDown(Keys.F))
                            {
                                if (selectedNode.toggleOrb)
                                {
                                    Color temp = selectedNode.color;
                                    selectedNode.color = selectedNode.toggleColor;
                                    selectedNode.toggleColor = temp;
                                    editorCooldown = 250;
                                }
                            }
                        }

                        if (Keyboard.GetState().IsKeyDown(Keys.T))
                        {
                            if (selectedNode.timeCountdownOrb == false)
                            {
                                selectedNode.timeCountdownOrb = true;
                                selectedNode.countdown = 10000;
                            }
                            else
                                selectedNode.timeCountdownOrb = false;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemPlus))
                        {
                            if(selectedNode.moveCountdownOrb)
                                selectedNode.countdown++;
                            if (selectedNode.timeCountdownOrb)
                                selectedNode.countdown += 1000;
                            editorCooldown = 250;
                        }
                        if (Keyboard.GetState().IsKeyDown(Keys.OemMinus))
                        {
                            if (selectedNode.moveCountdownOrb)
                                selectedNode.countdown--;
                            if (selectedNode.timeCountdownOrb)
                                selectedNode.countdown -= 1000;
                            editorCooldown = 250;
                        }
                    }

                }
            }

            // Update fragment animation positions
            for (int i = 0; i < fragmentList.Count; i++)
            {
                if (false == fragmentList[i].Update(gameTime))
                {
                    fragmentList.RemoveAt(i);
                }
            }
            // Update scoring animation positions
            for (int i = 0; i < scoreList.Count; i++)
            {
                if (false == scoreList[i].Update(gameTime))
                {
                    scoreList.RemoveAt(i);
                }
            }
            return GameStopCause.NONE;
        }
コード例 #52
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Mark(PuzzleBox box, MasterGrid grid)
 {
     box.Mark();
     grid.Mark();
 }
コード例 #53
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson7(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "Another advanced topic is bonus bubbles! You\n" +
     "may have noticed that when you match bubbles,\n" +
     "new ones slide in to take their place.:" +
     "But what happens if you match against two\n" +
     "bubbles in different tentacles at the same\n" +
     "time?:" +
     "This will create a bonus bubble of the same\n" +
     "color. Matching bonus bubbles will multiply\n" +
     "the score of the set by 2!:" +
     "Try rotating this orange bubble into the\n" +
     "lower left corner!";
     successText = "" +
     "Great! In addition to this bubble being\n" +
     "worth bonus points, you popped 3 outer\n" +
     "bubbles with just one inner bubble.:" +
     "That's a useful skill!";
     failureText = "" +
     "Oops! Try popping the bubbles in the lower\n" +
     "left corner first. This will give you a bonus\n" +
     "bubble!";
     restrictions = ControlRestrictions.None;
     Clear(box,grid);
     grid[0, 3] = new PuzzleNode(Color.Orange);
     grid[1, 4] = new PuzzleNode(Color.Orange);
     grid[4, 1] = new PuzzleNode(Color.Orange);
     box[0, 2, 2] = new PuzzleNode(Color.Orange);
 }
コード例 #54
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
        //Puzzle Load
        public static void LoadLesson(int index, PuzzleBox box, MasterGrid grid)
        {
            active             = true;
            introIndex         = 0;
            successIndex       = 0;
            failureIndex       = 0;
            controlLessonIndex = -5;
            phase = TutorialPhase.Intro;
            switch (index)
            {
            case (0):
                Lesson1(box, grid);
                break;

            case (1):
                Lesson2(box, grid);
                break;

            case (2):
                Lesson3(box, grid);
                break;

            case (3):
                Lesson4(box, grid);
                break;

            case (4):
                LessonBonus(box, grid);
                break;

            case (5):
                Lesson5(box, grid);
                break;

            case (6):
                Lesson6(box, grid);
                break;

            case (7):
                Lesson7(box, grid);
                break;

            case (8):
                Lesson8(box, grid);
                break;

            case (9):
                Lesson9(box, grid);
                break;

            case (10):
                Lesson10(box, grid);
                break;

            default:
                return;
            }
            if (loaded == true)
            {
                Mark(box, grid);
            }
            else
            {
                loaded = true;
            }
        }
コード例 #55
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson8(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "This technique will be especially important in\n" +
     "Challenge Mode. Try to match all the bubbles\n" +
     "here.:"+
     "To do so, you'll need to get the bonus bubbles\n" +
     "first again! Focus on the corners that contain\n"+
     "two bubbles of the same color.:"+
     "Also, don't forget the basics. Remember you can\n"+
     "use the left and right triggers to push and pull\n"+
     "the bubbles.";
     successText = "" +
     "Perfect! You're almost ready to get started\n" +
     "for real.";
     failureText = "" +
     "Oops! Remember, if you match one bubble against\n" +
     "two tentacles at the same time, it will be\n" +
     "replaced by a bonus bubble.:" +
     "You can reuse the bonus bubbles to make more\n" +
     "matches. Try getting the bonus bubbles first!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     box[0, 1, 2] = new PuzzleNode(Color.Yellow);
     box[0, 0, 0] = new PuzzleNode(Color.Magenta);
     grid[3, 0] = new PuzzleNode(Color.Magenta);
     grid[4, 1] = new PuzzleNode(Color.Magenta);
     grid[1, 4] = new PuzzleNode(Color.Magenta);
     grid[0, 1] = new PuzzleNode(Color.Yellow);
     grid[1, 0] = new PuzzleNode(Color.Yellow);
     grid[3, 4] = new PuzzleNode(Color.Yellow);
 }
コード例 #56
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson9(PuzzleBox box, MasterGrid grid)
 {
     introText = "" +
     "Okay! Let's combine what we've learned about sets\n" +
     "and bonus bubbles. See those three green bubbles\n" +
     "in the upper right?:" +
     "If we can match our two green bubbles at the\n" +
     "bottom with them, we can pop 5 bubbles at once!:" +
     "They'll also get replaced by two bonus bubbles,\n" +
     "which we can use to get another set!";
     successText = "Nice! That was worth a lot of points!";
     failureText = "" +
     "Oops! This one is tricky. Don't forget to use\n"+
     "The shoulder buttons for rotations and the\n"+
     "triggers to push and pull the bubbles.:"+
     "Try and get match the bubbles in the upper\n"+
     "right first!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     grid[3, 0] = new PuzzleNode(Color.Green);
     grid[4, 1] = new PuzzleNode(Color.Green);
     grid[4, 2] = new PuzzleNode(Color.Green);
     grid[0, 2] = new PuzzleNode(Color.Green);
     box[1, 2, 1] = new PuzzleNode(Color.Green);
     box[1, 2, 2] = new PuzzleNode(Color.Green);
 }
コード例 #57
0
ファイル: MasterGrid.cs プロジェクト: kevincos/PuzzleBox
 public MasterGrid Copy()
 {
     MasterGrid newGrid = new MasterGrid();
     for (int x = 0; x < gridSize; x++)
     {
         for (int y = 0; y < gridSize; y++)
         {
             newGrid[x, y] = arr[x, y].Copy();
             if (queues[x, y] != null)
             {
                 newGrid.queues[x, y] = new List<PuzzleNode>();
                 for (int z = 0; z < queues[x, y].Count; z++)
                     newGrid.queues[x, y].Add(queues[x, y][z].Copy());
             }
         }
     }
     return newGrid;
 }
コード例 #58
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
        public static void LessonBonus(PuzzleBox box, MasterGrid grid)
        {
            introText = "" +
            "We'll learn some advanced techniques soon,\n" +
            "but matching bubbles like this is the core\n" +
            "skill for any Jellyfish surgeon.:" +
            "So let's practice this some more!\n" +
            "Also, you can use the Right Control Stick at any\n" +
            "time to shift the camera angle.:" +
            "I like to set the camera so that all 27 bubbles\n" +
            "in the body are visible at the same time.:" +
            "But you should do whatever feels comfortable!\n" +
            "Now, match those bubbles!";

            successText = "" +
            "Way to go! You're getting the hang of it!\n" +
            "Let's talk about some more advanced topics!";
            failureText = "BUG!";
            Clear(box, grid);
            restrictions = ControlRestrictions.None;
            grid[2, 0] = new PuzzleNode(Color.Red);
            grid[3, 0] = new PuzzleNode(Color.Orange);
            grid[3, 4] = new PuzzleNode(Color.Orange);
            grid.queues[3, 4][0] = new PuzzleNode(Game.jellyBlue);
            grid[0, 1] = new PuzzleNode(Color.Magenta);
            grid.queues[3, 0][1] = new PuzzleNode(Game.jellyBlue);
            grid[1, 0] = new PuzzleNode(Game.jellyBlue);
            grid[0, 2] = new PuzzleNode(Color.Yellow);
            grid.queues[0, 2][0] = (new PuzzleNode(Color.Red));
            grid[4, 2] = new PuzzleNode(Color.Green);
            grid[2, 4] = new PuzzleNode(Color.Yellow);
            grid.queues[4, 2][0] = (new PuzzleNode(Color.Yellow));
            grid.queues[4, 2][1] = (new PuzzleNode(Color.Red));
            box[1, 1, 0] = new PuzzleNode(Color.Red);
            box[1, 0, 2] = new PuzzleNode(Color.Magenta);
            box[0, 2, 2] = new PuzzleNode(Game.jellyBlue);
            box[0, 1, 2] = new PuzzleNode(Color.Yellow);
            box[0, 0, 1] = new PuzzleNode(Color.Green);
            box[2, 0, 0] = new PuzzleNode(Color.Orange);
            box[2, 2, 2] = new PuzzleNode(Color.Orange);
        }
コード例 #59
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Lesson10(PuzzleBox box, MasterGrid grid)
 {
     introText = "Almost done! Lets do one more.:" +
     "There are three blue bubbles in the back right \n" +
     "of Mister Jellyfish. There also 5 blue bubbles \n" +
     "in the right tentacles.:" +
     "If you can bring all three of those blue bubbles \n" +
     "to the front, you can get 3 bonus bubbles to use \n" +
     "for a second set!";
     successText = ""+
     "Super! Looks like you're ready to get to work.\n" +
     "First, lets go over a few more quick things!:"+
     "There are three different types of Jellyfish\n" +
     "surgery to choose from, each of which poses\n" +
     "unique challenges.:"+
     "In Emergency mode, you'll race against the clock\n"+
     "to pop as many bubbles as you can.:" +
     "Scoring sets of 3 or more bubbles at a time is\n"+
     "key to getting a high score.:" +
     "Operation mode is similar, but you can relax and\n"+
     "take your time. However, you'll have a limited\n"+
     "number of moves to work with.:" +
     "Time isn't a factor, but you'll need to plan\n"+
     "your moves carefully and be efficient to get\n"+
     "a good score.:"+
     "Finally, Challenge mode will give you some\n"+
     "tricky puzzles to solve.:"+
     "You'll need to use what you've learned here to\n"+
     "pop all of the bubbles in each patient. If you make\n"+
     "a wrong move, you might get stuck!:"+
     "Luckily, in Challenge mode, you can press B to\n"+
     "undo your last move if you make a mistake.:"+
     "You'll be awarded a rating after each patient.\n"+
     "If you earn 3 stars, your patient will make a\n"+
     "full recovery and return to the sea!:"+
     "Try to save them all!\n";
     failureText = "" +
     "Oops! Try to rotate all three blue bubbles in\n" +
     "back to the front right. Then use the three\n" +
     "bonus bubbles to make a second set.:" +
     "Don't forget you can use the Right Control Stick\n" +
     "to get a better view of bubbles in the back!";
     restrictions = ControlRestrictions.None;
     Clear(box, grid);
     box[2, 0, 2] = new PuzzleNode(Game.jellyBlue);
     box[2, 1, 2] = new PuzzleNode(Game.jellyBlue);
     box[2, 2, 2] = new PuzzleNode(Game.jellyBlue);
     grid[3, 0] = new PuzzleNode(Game.jellyBlue);
     grid[3, 4] = new PuzzleNode(Game.jellyBlue);
     grid[4, 1] = new PuzzleNode(Game.jellyBlue);
     grid[4, 2] = new PuzzleNode(Game.jellyBlue);
     grid[4, 3] = new PuzzleNode(Game.jellyBlue);
     grid[1, 4] = new PuzzleNode(Game.jellyBlue);
 }
コード例 #60
0
ファイル: TutorialStage.cs プロジェクト: kevincos/PuzzleBox
 public static void Mark(PuzzleBox box, MasterGrid grid)
 {
     box.Mark();
     grid.Mark();
 }