Inheritance: IQtUserData
Exemple #1
0
    public bool Init()
    {
        UTestPrototypes.Init();

        m_quadtree = new UQuadtree(Bound);

        m_instRoot = GameObject.Find("Instances");
        if (m_instRoot == null)
        {
            return(false);
        }

        for (int i = 0; i < 5000; i++)
        {
            UTestQtUserData ud = UTestPrototypes.NewRandom();
            if (ud != null)
            {
                ud.gameObject.transform.localPosition = NewRandomPoint();
                ud.gameObject.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
                ud.gameObject.transform.localRotation = Quaternion.Euler(0.0f, Random.Range(0.0f, 360.0f), 0.0f);
                ud.gameObject.transform.parent        = m_instRoot.transform;
                ud.SwapOut();
                m_quadtree.Receive(ud);
            }
        }

        return(true);
    }
Exemple #2
0
    public static UTestQtUserData NewRandom()
    {
        int i = Random.Range(0, Prototypes.Count - 1);
        GameObject go = GameObject.Find(Prototypes[i].resPath);
        if (go == null)
            return null;

        UTestQtUserData ud = new UTestQtUserData();
        ud.gameObject = Object.Instantiate(go) as GameObject;
        ud.resPath = Prototypes[i].resPath;
        ud.bounds = ud.gameObject.GetComponent<Renderer>().bounds;
        return ud;
    }
Exemple #3
0
    public static UTestQtUserData NewRandom()
    {
        int        i  = Random.Range(0, Prototypes.Count - 1);
        GameObject go = GameObject.Find(Prototypes[i].resPath);

        if (go == null)
        {
            return(null);
        }

        UTestQtUserData ud = new UTestQtUserData();

        ud.gameObject = Object.Instantiate(go) as GameObject;
        ud.resPath    = Prototypes[i].resPath;
        ud.bounds     = ud.gameObject.GetComponent <Renderer>().bounds;
        return(ud);
    }
Exemple #4
0
    public static void Init()
    {
        GameObject go = GameObject.Find("Prototypes");
        if (go != null)
        {
            for (int i = 0; i < go.transform.childCount; i++)
            {
                GameObject prototype = go.transform.GetChild(i).gameObject;
                if (prototype != null)
                {
                    UTestQtUserData ud = new UTestQtUserData();
                    ud.resPath = go.name + '/' + prototype.name;
                    Prototypes.Add(ud);
                }
            }

            Debug.Log(go.transform.childCount.ToString() + " prototypes found.");
        }
    }
Exemple #5
0
    public static void Init()
    {
        GameObject go = GameObject.Find("Prototypes");

        if (go != null)
        {
            for (int i = 0; i < go.transform.childCount; i++)
            {
                GameObject prototype = go.transform.GetChild(i).gameObject;
                if (prototype != null)
                {
                    UTestQtUserData ud = new UTestQtUserData();
                    ud.resPath = go.name + '/' + prototype.name;
                    Prototypes.Add(ud);
                }
            }

            Debug.Log(go.transform.childCount.ToString() + " prototypes found.");
        }
    }