Beispiel #1
0
    public TransfromX[] GetRandomTransformXLayout(int id, Rect rect)
    {
        float rx, ry;
        int   num = id;

        switch (id)
        {
        case 11:
        case 15:
            num = 15;
            break;

        case 12:
        case 20:
            num = 20;
            break;

        case 13:
        case 30:
            num = 30;
            break;

        default:
            break;
        }
        TransfromX[] trans = new TransfromX[num];
        for (int i = 0; i < num; i++)
        {
            rx = Random.Range(rect.x, rect.xMax);
            ry = Random.Range(rect.y, rect.yMax);
            trans[i].position = new Vector3(rx, ry, 100);
            trans[i].scale    = new Vector3(.01f, .01f, .01f);
        }
        return(trans);
    }
    public GameObject Create(int regionID, int employeeID, string employeeName, TransfromX trans)
    {
        GameObject obj = Create(regionID, employeeID, employeeName);

        if (obj != null)
        {
            obj.transform.position   = trans.position;
            obj.transform.localScale = trans.scale;
        }
        return(obj);
    }
Beispiel #3
0
    public TransfromX[] ConvertRectToTransformX(Rect[] rects)
    {
        TransfromX[] trans = new TransfromX[rects.Length];
        float        scale;

        for (int i = 0; i < rects.Length; i++)
        {
            scale    = rects[i].height / _texHeight;
            trans[i] = new TransfromX()
            {
                position = new Vector3(rects[i].x + rects[i].width * .5f, _ScreenRect.height - rects[i].y - rects[i].height * .5f, 100),
                scale    = new Vector3(scale, scale, scale)
            };
        }
        return(trans);
    }