Пример #1
0
    void SelectRandomPoints()
    {
        GameObject[] points = GameObject.FindGameObjectsWithTag("Point");
        computerSelectedPointCount = 0;

        while (computerSelectedPointCount < 1)
        {
            int        i             = Random.Range(0, points.Length);
            GameObject selectedPoint = points[i];

            if (selectedPoint.GetComponent <SpriteRenderer>().color == DataScript.defaultColor)
            {
                selectedPoint.GetComponent <SpriteRenderer>().color = DataScript.computerColor;
                for (int j = 0; j < 2; j++)
                {
                    selectedPoint.GetComponent <PointScript>().ColorizeThePoint(computerColorStr);
                }

                computerSelectedPointCount++;
                DataScript.pointCountSelectedByComputer++;
            }
        }

        DataScript.inputLock = false;

        if (DataScript.pointCountSelectedByComputer == DataScript.pointCountToSelect)
        {
            lineGenerator = FindObjectOfType(typeof(LineGenerator)) as LineGenerator;
            lineGenerator.GenerateLinesBetweenPoints();
        }
    }