コード例 #1
0
    void drawBallLine(Runs ballRun)
    {
        // increase run count
        RunsCount[ballRun.GetValue() - 1]++;

        float length = ballRun.GetLength() / 10;
        int   zone   = ballRun.GetZone();

        GameObject shotline = Instantiate(ShotImg) as GameObject;

        shotline.transform.SetParent(Wheel.transform);
        shotline.transform.localPosition = Vector3.zero;

        ballRun.SetLine(shotline);

        //random angle for the give zone
        float angle = 45 * zone;

        angle = Random.Range((angle - 45) + 5, angle - 5);
        //random angle for the give zone
        shotline.transform.localEulerAngles        = new Vector3(0, 0, angle);
        shotline.GetComponent <Image>().fillAmount = length;
        shotline.GetComponent <Image>().color      = ShotColors[ballRun.GetValue() - 1];
    }