Пример #1
0
    public List <Vector3> GetPoints(int num)
    {
        List <Vector3> list   = new List <Vector3>();
        float          gap    = (angleEnd - angleBegin) / num;
        int            mi     = mGetPointIndex % 4;
        int            sg     = mi % 2 == 0 ? 1 : -1;
        float          offset = sg * gap / (1 + mi) + gap * 0.5f;

//		Debug.Log("offset=" + offset + "  mGetPointIndex=" + mGetPointIndex  + " count=" + count + " gap=" + gap);
        for (int i = 0; i < num; i++)
        {
            float   a = angleBegin + gap * i + offset;
            Vector3 p = HMath.PointAngle(o, a, r + mGetPointIndex * 0f);
            list.Add(p);
        }
        mGetPointIndex++;
        count += num;

        return(list);
    }
    public static void DrawCircle(Vector3 position, float radius)
    {
        //Gizmos
        int smoothAngle = 10;
        int count       = 360 / smoothAngle;

        Vector3 prePoint = HMath.PointAngle(position, 0, radius);
        Vector3 point;

        for (int i = 1; i < count - 1; i++)
        {
            int angle = smoothAngle * i;
            point = HMath.PointAngle(position, angle, radius);
            Gizmos.DrawLine(prePoint, point);
            prePoint = point;
        }

        point = HMath.PointAngle(position, 360, radius);
        Gizmos.DrawLine(prePoint, point);
    }
Пример #3
0
    public void Init()
    {
        float angle = angleBegin + (angleEnd - angleBegin) * 0.5f;

        center = HMath.PointAngle(o, angle, r);
    }