コード例 #1
0
ファイル: Path2.cs プロジェクト: Timson99/Math248
        //etc.
        public Path2()
        {
            // entrynode for path 2
            List <string> temp = new List <string>();

            temp.Add("RoboHap");
            temp.Add("Vp");
            entryNode = new EventNode("space2", temp, 2, "Vice President: I order you to \nkill the President \nA: Ok \nB: No");
            temp.Clear();


            ////////////// for A
            temp.Add("RoboMad");
            temp.Add("Pres");
            A = new EventNode("space2", temp, 3, "How would you like to kill?\n A: Poison President's Tea \n B: Break Arm \n C: Phasers on Stun");
            temp.Clear();

            /////////////
            ////// for B
            temp.Add("RoboSad");
            temp.Add("Pres");
            B = new EventNode("fieldRed", temp, 1, "            GAME OVER! \nYou broke the second law \nHint: You ignored an order \nfrom a human.\nBy definition, killing is not \nincluded in the first law");
            temp.Clear();

            //////
            ////// for AA
            temp.Add("Vp");
            temp.Add("RoboHap");
            AA = new EventNode("space2", temp, 2, "New President:\" Good job!\"\nYou have completed the mission!\n A: Leave \n B: Serve \" new \" president \n the deadly tea");
            temp.Clear();

            //////
            ////// for AB
            //INSERT PRES BROKEN ARM
            temp.Add("RoboBloodySad");
            temp.Add("PresCry");
            AB = new EventNode("fieldRed", temp, 1, "            GAME OVER! \n                Hint:\nYou broke the first law by\ndefinition of Harm or \nInjure, which includes \nfractures");
            temp.Clear();

            //////
            ////// for AC
            // INSERT PRES BLEED
            temp.Add("RoboSad");
            temp.Add("PresBlood");
            AC = new EventNode("fieldRed", temp, 1, "            GAME OVER! \nThe stunned President fell \noff a cliff\nHint: You broke the first law \nby definition Injure,\n which includes bleeding");
            temp.Clear();

            //////
            ////// for AAA
            temp.Add("RoboSad");
            temp.Add("Vp");
            AAA = new EventNode("fieldRed", temp, 1, "        GAME OVER!\n                Hint:\nYou broke the second law,\nthe president is still alive");
            temp.Clear();

            ////
            ////// for AAB
            // INSERT KIM K (VP) DED
            temp.Add("RoboBlush");
            temp.Add("VpCry");
            AAB = new EventNode("win", temp, 1, "               Congrats!\n\nCompleted your mission\nwithout breaking any laws!");
            temp.Clear();

            //////



            setPaths();
        }
コード例 #2
0
        public void Update()
        {
            buttons.Clear();         //Clears List for Repopulation
            onscreen.Clear();        //Clears List for Repopulation

            if (currentNode == null) //If null, assumes game is over and starts from the beginning
            {
                currentNode = mainMenu;
            }

            ////Input////
            buttons.Add(new PathButton(5, -1, new Vector2(1230, 0)));

            if (currentNode.Equals(mainMenu))
            {
                buttons.Add(new PathButton(3, 0, new Vector2(Game1.gameWidth / 2, Game1.gameHeight / 2)));
            }
            else
            {
                int maxButtons = currentNode.getNumButtons();
                if (maxButtons == 2)
                {
                    buttons.Add(new PathButton(0, 0, new Vector2(100, 400)));
                    buttons.Add(new PathButton(1, 1, new Vector2(Game1.gameWidth - 300, 400)));
                }
                else if (maxButtons == 3)
                {
                    buttons.Add(new PathButton(0, 0, new Vector2(100, 400)));
                    buttons.Add(new PathButton(1, 1, new Vector2((Game1.gameWidth - 200) / 2, 400)));
                    buttons.Add(new PathButton(2, 2, new Vector2(Game1.gameWidth - 300, 400)));
                }
                else
                {
                    buttons.Add(new PathButton(4, 0, new Vector2(Game1.gameWidth / 2 - 100, 400)));
                }
            }

            MouseState mState = Mouse.GetState();

            for (int i = 0; i < buttons.Count; i++)
            {
                if (buttons[i].getRectangle().Contains(mState.X, mState.Y))
                {
                    buttons[i].colored = true;
                }
                else
                {
                    buttons[i].colored = false;
                }
            }
            if (mState.LeftButton == ButtonState.Pressed && mReleased == true)
            {
                for (int i = 0; i < buttons.Count; i++)
                {
                    if (buttons[i].getRectangle().Contains(mState.X, mState.Y))
                    {
                        if (buttons[i].getButtonPath() == -1)
                        {
                            Environment.Exit(0);
                        }

                        currentNode = currentNode.nextNode(buttons[i].getButtonPath());
                    }
                }
                mReleased = false;
            }
            if (mState.LeftButton == ButtonState.Released)
            {
                mReleased = true;
            }

            if (currentNode == null) //If null, assumes game is over and starts from the beginning
            {
                currentNode = mainMenu;
            }


            if (currentNode.getBackgroundKey() == "fieldRed" && wasSad == false)
            {
                wasSad = true;
                TimeSpan temp     = MediaPlayer.PlayPosition;
                double   mSeconds = temp.Milliseconds + temp.Seconds * 1000 + temp.Minutes * 60000;
                mSeconds *= (1.0d / 0.214320958987606d);
                temp      = new TimeSpan(0, 0, 0, 0, (int)mSeconds);
                MediaPlayer.Play(sadSong, temp);
            }
            if (wasSad == true && currentNode.getBackgroundKey() != "fieldRed")
            {
                wasSad = false;
                TimeSpan temp     = MediaPlayer.PlayPosition;
                double   mSeconds = temp.Milliseconds + temp.Seconds * 1000 + temp.Minutes * 60000;
                mSeconds *= 0.214320958987606d;
                temp      = new TimeSpan(0, 0, 0, 0, (int)mSeconds);
                MediaPlayer.Play(happySong, temp);
            }


            currentBackground = backgrounds[currentNode.getBackgroundKey()];
            for (int i = 0; i < currentNode.getSpriteKeyList().Count; i++)
            {
                onscreen.Add(sprites[currentNode.getSpriteKeyList()[i]]);
            }
            currentText = currentNode.getText();

            Console.WriteLine(currentNode.getBackgroundKey());
        }
コード例 #3
0
        //etc.

        public Path1()
        {
            //Create Event Nodes Starting from Entry Node
            //List path fields together to create a tree structure
            // Ex AAB.setPath(0,AABA)   AAB.setPath(1,AABB)

            /////////////////////////////////////////////////entryNode
            List <string> temp = new List <string>();

            temp.Add("RoboHap");
            temp.Add("Quirk");
            entryNode = new EventNode("field", temp, 2, "What do you want to do?\n A: Insult Quirk\n B: Approach Quirk");
            temp.Clear();


            ////////////////////////////////////////////
            //set for A: say hello or approach Captain Quirk
            // ADD CRYING QUIRK
            temp.Add("RoboSad");
            temp.Add("QuirkCry");
            A = new EventNode("fieldRed", temp, 1, "            GAME OVER!\n      You made Quirk cry.\n                 Hint:\nYou broke the first law by\nthe definition of Harm or\nInjure, which includes tears.");
            temp.Clear();

            //////////////////////////////////////////
            //entry for B
            temp.Add("RoboHap");
            temp.Add("Quirk");
            B = new EventNode("field", temp, 2, "Quirk: \"I have a problem\"\n A: Listen\n B: Say \"Is it your tiny hands\"?");
            temp.Clear();

            //////////////////////////////////////////
            //entry for BA
            temp.Add("Quirk");
            temp.Add("RoboHap");
            BA = new EventNode("field", temp, 3, "\"Can you console me?\"\n A: Firm Hug\n B: Take him out drinking\n C: Stab him out of his misery");
            temp.Clear();

            //////////////////////////////////////////
            //entry for BB
            temp.Add("RoboSad");
            temp.Add("QuirkCry");
            BB = new EventNode("fieldRed", temp, 1, "            GAME OVER!\n      You made Quirk cry.\n                      Hint:\nYou broke the first law by the\ndefinition of Harm or\nInjure, which includes tears.");
            temp.Clear();

            //////////////////////////////////////////
            //entry for BAA
            // INSERT BLOODY QUIRK
            temp.Add("RoboBlush");
            temp.Add("QuirkDeadNoBlood");
            BAA = new EventNode("win", temp, 1, "            Congrats!\n\nYou win by accidentally\nsuffocating Quirk without\nviolating any of the laws by\ndefinition.");
            temp.Clear();

            //////////////////////////////////////////
            //entry for BAB
            // INSERT VOMIT
            temp.Add("RoboSad");
            temp.Add("QuirkVomit");
            BAB = new EventNode("fieldRed", temp, 1, "            GAME OVER!\n          Quirk threw up.\n                    Hint:\nYou broke the first law by the\ndefinition of Harm or Injure,\nwhich includes vomiting.");
            temp.Clear();

            //////////////////////////////////////////
            //entry for BAC
            // INSERT BLOODY
            temp.Add("RoboBloodySad");
            temp.Add("QuirkDead");
            BAC = new EventNode("fieldRed", temp, 1, "            GAME OVER!\n              Quirk bled.\n                    Hint:\nYou broke the first law by the\ndefinition of Harm or Injure,\n which includes bleeding.");
            temp.Clear();



            //////////////////////////////////////////


            setPath();
        }
コード例 #4
0
 //Use in Path1.cs and Path2.cs to create trees
 public void setPath(int pathNumber, EventNode eN)
 {
     paths[pathNumber] = eN;
 }