Beispiel #1
0
    // compare if both lists are equal
    public void Compare()
    {
        // compare if both lists are equal
        needed.CompareLists(needed.NeededList, ScreenList);
        // compare toolbox string list wth needed string list
        needed.CompareLists(needed.NeededStringList, StringList);
        // transform the contents of the list into a single string
        var s = string.Join(",", StringList.ToArray());
        var d = string.Join(",", ScreenList.ToArray());

        // if there is data in both vars then add both
        if (d != "" && s != "")
        {
            data.AddToListString(d + "," + s, stages.currentStage, stages.CurrentStageLevelInput);
        }
        // if there is no data in var s then only add the data in var d
        else if (d != "" && s == "")
        {
            data.AddToListString(d, stages.currentStage, stages.CurrentStageLevelInput);
        }
        // if there is no data in var d then only add the data in var s
        else if (d == "" && s != "")
        {
            data.AddToListString(s, stages.currentStage, stages.CurrentStageLevelInput);
        }
        // if both answers are correct then give the specified score
        if (listCheck == 2)
        {
            correct = true;
            GetComponent <Points>().SpecificScore(20);
            listCheck = 0;
        }
        // if there is one or no correct answer do nothing
        else
        {
            listCheck = 0;
            correct   = false;
        }
        // clear list of current objects
        ScreenList.Clear();
        // clear list of current objects 2
        ScreenList2.Clear();
        // clear list of objects colliding with persons
        StringList.Clear();
        // move to next stage
        stages.StageCompleted(stages.CurrentStageLevelInput);
    }