Пример #1
0
    public string[] getSolutionKeywords()
    {
        switch (currentProblemType)
        {
        case ProblemTypes.PartNotWorking: {
            int row = 0;
            int col = 0;
            switch (currentProblemPart)
            {
            case "brake_shift":  row = 0; break;

            case "transmission": row = 1; break;

            case "carburetor":   row = 2; break;
            }
            switch (currentProblemReported)
            {
            case "emitting_smoke":         col = 0; break;

            case "stuck_in_place":         col = 1; break;

            case "shaking_uncontrollably": col = 2; break;
            }
            string[] strings = CarProblems.GetKeywordsForPartProblem(row, col, brakeShift2005, !carburetorValveOpen, !brakeShift2005);
            return(strings);
        }

        case ProblemTypes.WarningLight: {
            int row = 0;
            int col = 0;
            switch (currentWarningFrame)
            {
            case WarningLightFrames.VerticalScroll:   row = 0; break;

            case WarningLightFrames.Paper:            row = 1; break;

            case WarningLightFrames.HorizontalScroll: row = 2; break;
            }
            switch (currentStarPoints)
            {
            case 10: col = 0; break;

            case 7:  col = 1; break;

            case 8:  col = 2; break;
            }
            string[] strings = CarProblems.GetKeywordsForLightProblem(row, col, IsMultipleOfSeven, EndsInNine, InFibonacciSequence);
            return(strings);
        }

        default:
            break;
        }
        return(new string[1] {
            "battery"
        });
    }
Пример #2
0
    void checkTextForKeyWords(string text)
    {
        setGameState(GAME_STATE.SPEAKING);
        Debug.Log(text + " " + myCar.getSolutionKeywords()[0] + " " + myCar.getSolutionKeywords()[2]);

        int failureKeywordsFound = 0;

        foreach (string s in CarProblems.AllKeywords())
        {
            if (text.ToLower().Contains(s.ToLower()))
            {
                failureKeywordsFound++;
            }
        }

        int successKeyWordsFound = 0;

        foreach (string s in myCar.getSolutionKeywords())
        {
            if (text.ToLower().Contains(s.ToLower()))
            {
                successKeyWordsFound++;
                failureKeywordsFound--;
            }
        }

        bool isWarningLight = myCar.currentProblemType == ProblemTypes.WarningLight;

        if (failureKeywordsFound >= 2)
        {
            Debug.Log("incorrect");
            incorrectCommandGiven();
        }
        else if (successKeyWordsFound >= 2)
        {
            Debug.Log("correct");
            myCar.solveCurrentProblem();
        }

        else if (text.ToLower().Contains("brake shift") || text.ToLower().Contains("break shift"))
        {
            myCar.reportState(ReportTypes.brakeShift);
        }
        else if (text.ToLower().Contains("carburetor valve"))
        {
            myCar.reportState(ReportTypes.valve);
        }
        else if (text.ToLower().Contains("transmission"))
        {
            myCar.reportState(ReportTypes.transmission);
        }

        else if (isWarningLight && (text.ToLower().Contains("describe") || text.ToLower().Contains("look") || text.ToLower().Contains("looks") || text.ToLower().Contains("which")))
        {
            myCar.reportState(ReportTypes.warningFrame);
        }
        else if (isWarningLight && (text.ToLower().Contains("points")))
        {
            myCar.reportState(ReportTypes.pointsInStar);
        }
        else if (text.ToLower().Contains("number") || text.ToLower().Contains("center") || text.ToLower().Contains("middle"))
        {
            if (isWarningLight)
            {
                myCar.reportState(ReportTypes.numberInCenter);
            }
            else
            {
                myCar.DidntUnderstand();
            }
        }

        else if (text.ToLower().Contains("repeat") || text.ToLower().Contains("again") || text.ToLower().Contains("problem"))
        {
            myCar.playAudioDescriptionOfProblem();
        }
        else
        {
            // incorrect solution?
            myCar.DidntUnderstand();
        }
    }