Esempio n. 1
0
    private void UpdateData()
    {
        Transform ball;
        Transform cue = gameObject.transform.GetChild(0);

        for (int x = 0; x < ballData.Length; x++)
        {
            ball = gameObject.transform.GetChild(x + 1);
            float[] holesDist = new float[6];
            float   cueDist   = Mathf.Abs(Vector2.Distance(cue.localPosition, ball.localPosition));
            float   cueAngle  = pg.AngleBetween(cue.localPosition, ball.localPosition);
            for (int y = 0; y < 6; y++)
            {
                float distance = Mathf.Abs(Vector3.Distance(holes[y].localPosition, ball.localPosition));
                holesDist[y] = distance;
            }
            Data temp = new Data(cueDist, cueAngle, holesDist);
            ballData[x] = temp;
        }
    }