Example #1
0
    override public void Action(GameState gameState, List <string[]> pairInputs)
    {
        string noun = pairInputs[0][1];

        if (gameState.currentLocation.checkIfContainsItem(noun))
        {
            Item item = gameState.currentLocation.getItemFromText(noun);
            if (item.canTalk)
            {
                List <Item> requiredItems = new List <Item>(item.dialog.requiredItems);
                foreach (Item i in GameState.currentState.inventory)
                {
                    requiredItems.Remove(i);
                }
                if (requiredItems.Count == 0)
                {
                    GameState.startDialog(item.dialog);
                }
                else
                {
                    TextOutputManager.sendOutput("You don't know if you have anything to talk about.", GameState.currentState.defaultColor);
                }
            }
        }
        else
        {
            TextOutputManager.sendOutput("They don't seem interested in talking.", GameState.currentState.defaultColor);
        }
    }
 private void Enter()
 {
     TextOutputManager.sendOutput("-> " + textMesh.text, GameState.currentState.defaultColor);
     TextParser.Parse(textMesh.text);
     LogInput();
     ClearInput();
 }
Example #3
0
    override public void Action(GameState gameState, List <string[]> pairInputs)
    {
        if (pairInputs.Count == 1)
        {
            string noun = pairInputs[0][1];

            //Check to see if it is a valid location
            //Go to it if possible
            //Otherwise, yell at the player

            if (gameState.currentLocation.checkIfConnectedLocation(noun))
            {
                Location newLocation = gameState.currentLocation.getLocationFromText(noun);
                gameState.currentLocation = newLocation;
                TextOutputManager.sendOutput("You are now in the " + newLocation.identifiers[0] + ".", GameState.currentState.defaultColor);
            }
            else
            {
                TextOutputManager.sendOutput("I cannot go to " + noun + ".", GameState.currentState.defaultColor);
            }
        }
        else if (pairInputs.Count == 0)
        {
            TextOutputManager.sendOutput("Where?", GameState.currentState.defaultColor);
        }
        else
        {
            TextOutputManager.sendOutput("I don't know how to go there.", GameState.currentState.defaultColor);
        }
    }
Example #4
0
 void Start()
 {
     if (output == null)
     {
         output = this;
     }
     else
     {
         Debug.Log("You have many text outputs, dont do that");
         Debug.Break();
     }
 }
Example #5
0
 override public void Action(GameState gameState, List <string[]> pairInputs)
 {
     //Check if the first noun exists
     if (pairInputs.Count > 0)
     {
         string noun = pairInputs[0][1];
         //Find the noun somwhere
         //The noun can be in the room or you backpack.
         Item item = null;
         if (gameState.currentLocation.checkIfContainsItem(noun))
         {
             item = gameState.currentLocation.getItemFromText(noun);
         }
         else if (gameState.checkInventoryForItem(noun) != null)
         {
             item = gameState.checkInventoryForItem(noun);
         }
         if (item != null)
         {
             //Look in the item for a use case that works!
             foreach (UseCase c in item.cases)
             {
                 if (c.checkCase(pairInputs))
                 {
                     c.Action();
                     return;
                 }
             }
             TextOutputManager.sendOutput("I cannot use " + noun + " like that.", GameState.currentState.defaultColor);
         }
         else
         {
             TextOutputManager.sendOutput("I cannot use that.", GameState.currentState.defaultColor);
             return;
         }
     }
     else
     {
         TextOutputManager.sendOutput("Use what, how?", GameState.currentState.defaultColor);
     }
 }
Example #6
0
        public void CreateSummaryReport(string rootDirectory)
        {
            //Console.WriteLine("Creating Test Suite Summary Report");

            string fullyQulaifiedSummaryFileName        = rootDirectory + Path.DirectorySeparatorChar + CoarseGrind.SUMMARY_FILE_NAME;
            DelimitedDataManager <string> summaryReport = null;

            try
            {
                summaryReport = DelimitedDataManager <string> .FromFile(fullyQulaifiedSummaryFileName, new StringParser());
            }
            catch
            {
                summaryReport = new DelimitedDataManager <string>(columnNames: SUMMARY_HEADERS);
            }

            foreach (Test thisCase in this)
            {
                //if (thisCase.wasRun) summaryReport.addDataRow(thisCase.getSummaryDataRow());
                if (thisCase.WasSetup)
                {
                    summaryReport.addDataRow(thisCase.SummaryDataRow);
                }
            }

            summaryReport.ToFile(fullyQulaifiedSummaryFileName);

            string fullyQulaifiedSummaryTextFileName = rootDirectory + Path.DirectorySeparatorChar + CoarseGrind.SUMMARY_TEXTFILE_NAME;

            try
            {
                TextOutputManager textFile = new TextOutputManager(fullyQulaifiedSummaryTextFileName);
                textFile.WriteLine(OverallStatus.ToString());
                textFile.Flush();
                textFile.Close();
            }
            catch
            {
                // DELIBERATE NO-OP
            }
        }
    override public void Action()
    {
        bool hasClothes  = GameState.currentState.checkInventoryForItem("CLOTHES");
        bool hasBackpack = GameState.currentState.checkInventoryForItem("BACKPACK");

        if (hasClothes && hasBackpack)
        {
            SceneManager.LoadScene("HackathonExposition");
        }
        else if (hasClothes)
        {
            TextOutputManager.sendOutput("How do you expect to do a hackathon without a computer? You’re not that good at programming.", GameState.currentState.storyColor);
        }
        else if (hasBackpack)
        {
            TextOutputManager.sendOutput("Sorry, not wearing clothes stopped being cute when you hit puberty.", GameState.currentState.storyColor);
        }
        else
        {
            TextOutputManager.sendOutput("You’re not great at following instructions are you? Why don’t you try again?", GameState.currentState.storyColor);
        }
    }
Example #8
0
    public void outputContentsAsString()
    {
        TextOutputManager.sendOutput("Nearby Locations: ", GameState.currentState.defaultColor);

        {
            string ret = "";
            foreach (Location l in connectedLocations)
            {
                ret += l.identifiers[0] + "   ";
            }
            TextOutputManager.sendOutput(ret, GameState.currentState.locationColor);
        }
        TextOutputManager.sendOutput("Nearby Things: ", GameState.currentState.defaultColor);
        {
            string ret = "";
            foreach (Item l in items)
            {
                ret += l.identifiers[0] + "   ";
            }
            TextOutputManager.sendOutput(ret, GameState.currentState.itemColor);
        }
    }
Example #9
0
    void Update()
    {
        if (once && Input.GetKeyDown(KeyCode.Return))
        {
            twice = true;
        }

        if (GameState.currentState.currentLocation.identifiers[0].Equals("AUDITORIUM") && !once)
        {
            TextOutputManager.sendOutput("A student, pale as a ghost is crouching over a body. " +
                                         "They have their hands clasped over the mouth. Your worst fears come to mind as you rush towards the stage. " +
                                         "As you get closer, you stumble to your knees. The last thing you remember before passing out is Kevin’s ashen " +
                                         "face, in a pool of his own blood. ", GameState.currentState.storyColor);
            once = true;
        }


        if (Input.GetKeyDown(KeyCode.Return) && once && twice)
        {
            Debug.Log("yeah it just went");
            SceneManager.LoadScene("OpenExploration");
        }
    }
Example #10
0
 override public void Action(GameState gameState, List <string[]> pairInputs)
 {
     //check to see if the item exists
     //check to see if it can be taken
     //put it in inventory
     //remove from the room
     if (pairInputs.Count == 1)
     {
         string noun = pairInputs[0][1];
         if (gameState.currentLocation.checkIfContainsItem(noun))
         {
             Item item = gameState.currentLocation.getItemFromText(noun);
             if (item.canPickup == true)
             {
                 gameState.currentLocation.removeItem(item);
                 GameState.addToInventory(item);
                 TextOutputManager.sendOutput("You took the " + noun + ".", GameState.currentState.defaultColor);
             }
             else
             {
                 TextOutputManager.sendOutput("You cannot take " + noun + ".", GameState.currentState.defaultColor);
             }
         }
         else if (gameState.checkInventoryForItem(noun) != null)
         {
             TextOutputManager.sendOutput("You already have " + noun + ".", GameState.currentState.defaultColor);
         }
         else
         {
             TextOutputManager.sendOutput("Take what?", GameState.currentState.defaultColor);
         }
     }
     else
     {
         TextOutputManager.sendOutput("Take what?", GameState.currentState.defaultColor);
     }
 }
Example #11
0
 private static void sendError(string errorText)
 {
     //Debug.Log(errorText);
     TextOutputManager.sendOutput(errorText, GameState.currentState.errorColor);
 }
Example #12
0
    override public void Action(GameState gameState, List <string[]> pairInputs)
    {
        //Check to see what we are looking at.
        //No pairs, means look around the current room
        if (pairInputs.Count == 1)
        {
            //We are looking at here
            //or We are looking at an item
            //or we are looking at a location
            string noun = pairInputs[0][1];
            Debug.Log(noun.Equals("TIREIRON"));
            Debug.Log(GameState.currentState.currentLocation.identifiers[0].Equals("BASEMENT"));
            if (noun.Equals("TIREIRON") && GameState.currentState.currentLocation.identifiers[0].Equals("BASEMENT"))
            {
                GameState.startEndgameScene();
            }


            if (WordLibrary.compareStringToArray(noun, WordLibrary.syn_Room))
            {
                //Load up the room box text
                TextOutputManager.sendOutput(gameState.currentLocation.boxText, GameState.currentState.storyColor);
                gameState.currentLocation.outputContentsAsString();
            }
            else if (WordLibrary.compareStringToArray(noun, WordLibrary.syn_Inventory))
            {
                //Load up the room box text
                TextOutputManager.sendOutput(GameState.getItemsAsText(), GameState.currentState.itemColor);
            }
            else if (gameState.currentLocation.checkIfConnectedLocation(noun))
            {
                //Load up the room box text for the other room
                TextOutputManager.sendOutput(
                    gameState.currentLocation.getRelativeBoxTextForLocation(
                        gameState.currentLocation.getLocationFromText(noun)
                        ),
                    GameState.currentState.storyColor
                    );
            }
            else if (gameState.currentLocation.checkIfContainsItem(noun))
            {
                //Load up box text for the item.
                //get the item
                //get the items box text.
                //print it
                TextOutputManager.sendOutput(gameState.currentLocation.getItemFromText(noun).boxText, GameState.currentState.storyColor);
            }
            else if (gameState.checkInventoryForItem(noun) != null)
            {
                TextOutputManager.sendOutput(gameState.checkInventoryForItem(noun).boxText, GameState.currentState.storyColor);
            }
            else
            {
                TextOutputManager.sendOutput("I dont see a " + noun + ".", GameState.currentState.defaultColor);
            }
        }
        else if (pairInputs.Count == 0)
        {
            TextOutputManager.sendOutput(gameState.currentLocation.boxText, GameState.currentState.storyColor);
            gameState.currentLocation.outputContentsAsString();
        }
    }
    // Update is called once per frame
    void Update()
    {
        string str = Input.inputString;

        if (GameState.currentDialog != null)
        {
            bool pressedEnter = false;
            if (str.Length == 1 && ((int)str[0]) == 13)
            {
                if (Input.GetKeyDown(KeyCode.Return))
                {
                    pressedEnter = true;
                }
            }


            if (pressedEnter)
            {
                //Finish the response typing
                //Do the next thing
                //if there is nothing else, null our dialog and return
                textMesh.text += GameState.currentDialog.dialog[GameState.currentDialog.Progress].response;
                TextOutputManager.sendOutput(textMesh.text, GameState.currentState.itemColor);
                ClearInput();
                if (GameState.currentDialog.Progress >= GameState.currentDialog.dialog.Length - 1)
                {
                    // we are done
                    foreach (Item i in GameState.currentDialog.endOfDialogItems)
                    {
                        GameState.addToInventory(i);
                    }
                    GameState.currentDialog = null;
                }
                else
                {
                    GameState.currentDialog.Progress++;
                    TextOutputManager.sendOutput(GameState.currentDialog.dialog[GameState.currentDialog.Progress].statement, GameState.currentState.storyColor);
                }
            }
            else
            {
                int    count = str.Length;
                string leftover;
                string toType = "";

                if (count > GameState.currentDialog.dialog[GameState.currentDialog.Progress].response.Length - 1)
                {
                    toType   = GameState.currentDialog.dialog[GameState.currentDialog.Progress].response;
                    leftover = "";
                }
                else
                {
                    for (int i = 0; i < count; i++)
                    {
                        toType += GameState.currentDialog.dialog[GameState.currentDialog.Progress].response[i];
                    }
                    leftover = GameState.currentDialog.dialog[GameState.currentDialog.Progress].response.Substring(count);
                }
                //Debug.Log(leftover);
                GameState.currentDialog.dialog[GameState.currentDialog.Progress].response = leftover;
                textMesh.text += toType.ToUpper();
            }
            return;

            //End of dialog stuff
        }
        else
        {
            //Had issues with the input hanging up because backspace and enter are accepted by Input.inputString
            //So we screen specially for these two inputs
            // Backspace == 8, Enter = 13
            //We then check for the click so holding it down does not break things
            if (Input.GetKeyDown(KeyCode.Home))
            {
                Application.Quit();
            }
            else if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                //if we were not already using hte arrow keys, reset the counter
                if ((lastInput == InputType.DownArrow || lastInput == InputType.UpArrow) == false)
                {
                    logProgress = -1;
                }
                UpArrow();
                lastInput = InputType.UpArrow;
            }
            else if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                // if we where not already using the arrow keys, reset the counter
                if ((lastInput == InputType.DownArrow || lastInput == InputType.UpArrow) == false)
                {
                    logProgress = -1;
                }
                DownArrow();
                lastInput = InputType.DownArrow;
            }
            else
            {
                if (str.Length == 1 && ((int)str[0]) == 8)
                {
                    if (Input.GetKeyDown(KeyCode.Backspace))
                    {
                        Backspace();
                        lastInput = InputType.Backspace;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.Delete))
                {
                    Backspace();
                    lastInput = InputType.Backspace;
                }
                else if (str.Length == 1 && ((int)str[0]) == 13)
                {
                    if (Input.GetKeyDown(KeyCode.Return))
                    {
                        Enter();
                        lastInput = InputType.Enter;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.Escape))
                {
                    Escape();
                    lastInput = InputType.Escape;
                }
                else if (Input.GetKeyDown(KeyCode.Tab))
                {
                    Tab();
                    lastInput = InputType.Tab;
                }
                else if (str.Length > 0)
                {
                    //Debug.Log((int)str[0]);
                    textMesh.text = textMesh.text + str.ToUpper();
                    lastInput     = InputType.Text;
                }
            }
        }
    }
Example #14
0
 public static void startDialog(Dialog d)
 {
     GameState.currentDialog = d;
     TextOutputManager.sendOutput(d.dialog[0].statement, GameState.currentState.storyColor);
 }