コード例 #1
0
    private bool CheckObjectiveComplete(string nextObj)
    {
        string[] objSplit = nextObj.Split('>');

        string type      = objSplit[0].Trim();
        bool   completed = false;

        switch (type)
        {
        case "build":
            string molFile = CheckMoleculeRepresentation(objSplit[1].Trim()); //to get the correct name of the file in case the structure is being used
            string text    = HandleTextFile.ReadString(molFile + "Bonds.txt");
            if (MM.CompareMoleculesString(text, false))
            {
                completed = true;
                PS.StopMovesCounter();
            }
            break;

        case "complete":
            string molDes = CheckMoleculeDescription(objSplit[1].Trim());
            if (IsMoleculeComplete(molDes))
            {
                completed = true;
                PS.StopMovesCounter();
            }
            break;

        case "transform":
            string molDes1 = CheckMoleculeDescription(objSplit[1].Trim());
            if (IsMoleculeComplete(molDes1))
            {
                completed = true;
                PS.StopMovesCounter();
            }
            break;

        case "load":
            if (correctMolLoaded)
            {
                correctMolLoaded = false;
                completed        = true;
            }
            break;

        case "save":
            string savedText = HandleTextFile.ReadString(objSplit[1].Trim() + ".txt");
            if (MM.CompareMoleculesString(savedText, true))
            {
                completed = true;
            }
            break;

        case "place":
            GameObject invi = GameObject.FindGameObjectWithTag("Invisible");
            if (invi.GetComponent <InvisibleMoleculeBehaviour>().HasOverlap())
            {
                completed = true;
                invi.GetComponent <InvisibleMoleculeBehaviour>().DestroyOverlap();
                Destroy(invi);
            }
            break;

        case "multiple choice":
            Debug.Log(pressedAnswer);
            Debug.Log(correctAnswerMC);
            if (pressedAnswer.ToLower().Trim() == correctAnswerMC.ToLower().Trim())
            {
                completed = true;
                PS.UpdateAnswers();
                PS.StopAnswersCounter();
                RemoveAllMolecules();
            }
            PS.UpdateAnswers();
            break;
        }
        return(completed);
    }