Exemple #1
0
    public void selectRelation()
    {
        //operationMenu.SetActive(false);
        //cancelButton.SetActive(false);
        //infoMenu.SetActive(true);
        int linecnt  = GlobalData.selectedLine.Count;
        int planecnt = GlobalData.selectedPlane.Count;

        if (linecnt == 2 && planecnt == 0)
        {
            Vector3[]  line1    = GlobalData.selectedLine[0];
            Vector3[]  line2    = GlobalData.selectedLine[1];
            LLRELATION relation = MathCalculate.llRelation(line1, line2);
            //GameObject.Find("Canvas/InfoMenu/InfoText").GetComponent<Text>().text = "Relation of the two selected lines is : " + MathCalculate.toString(relation) + ".";
            character.GetComponentInChildren <charEvent>().speakSomething("线线间几何关系为\n" + MathCalculate.toString(relation));
        }
        else if (linecnt == 1 && planecnt == 1)
        {
            Vector3[]  line     = GlobalData.selectedLine[0];
            Vector3[]  plane    = GlobalData.selectedPlane[0];
            LPRELATION relation = MathCalculate.lpRelation(line, plane);
            //GameObject.Find("Canvas/InfoMenu/InfoText").GetComponent<Text>().text = "Relation of selected line and plane is : " + MathCalculate.toString(relation) + ".";
            character.GetComponentInChildren <charEvent>().speakSomething("线面间几何关系为\n" + MathCalculate.toString(relation));
        }
        else if (linecnt == 0 && planecnt == 2)
        {
            Vector3[]  plane1   = GlobalData.selectedPlane[0];
            Vector3[]  plane2   = GlobalData.selectedPlane[1];
            PPRELATION relation = MathCalculate.ppRelation(plane1, plane2);
            //GameObject.Find("Canvas/InfoMenu/InfoText").GetComponent<Text>().text = "Relation of two selected planes is : " + MathCalculate.toString(relation) + ".";
            character.GetComponentInChildren <charEvent>().speakSomething("面面间几何关系为\n" + MathCalculate.toString(relation));
        }
        else
        {
            //GameObject.Find("Canvas/InfoMenu/InfoText").GetComponent<Text>().text = "Selection is not correct.";
            character.GetComponentInChildren <charEvent>().speakSomething("选择存在错误");
        }
    }
    public static string toString(PPRELATION relation)
    {
        switch (relation)
        {
        case PPRELATION.VERTICAL:
            return("vertical");

        case PPRELATION.SAME:
            return("the same plane");

        case PPRELATION.PARALLEL:
            return("parallel");

        case PPRELATION.INTERSECT:
            return("intersect");

        case PPRELATION.ERROR:
            return("error");

        default:
            return("error");
        }
    }