Ejemplo n.º 1
0
    public void Rebuild()
    {
        foreach (CycleInfoCPU ci in cycleInfo)
        {
            DestroyImmediate(ci.gameObject);
        }

        cycleInfo = new List <CycleInfoCPU>();

        CycleInfoCPU ci2 = GetComponent <CycleInfoCPU>();

        ci2.cycle = data;


        Spawn(GetComponent <CycleInfoCPU>(), 1);
    }
Ejemplo n.º 2
0
    public void Spawn(CycleInfoCPU p_cycleInfo, int currentLevel)
    {
        int siblingCount = p_cycleInfo.cycle.Cycles.Count;
        int id           = 0;

        List <CycleInfoCPU> childList = new List <CycleInfoCPU>();


        foreach (Cycle c in p_cycleInfo.cycle.Cycles)
        {
            GameObject child = Instantiate(CyclePrefab);
            child.transform.parent        = p_cycleInfo.transform;
            child.transform.localPosition = new Vector3((int)id, -1, Random.Range(-.99f, .99f) * 20);
            child.transform.localScale    = new Vector3(.6f, .6f, .6f);
            child.name = "" + c.gameObject.name + " || " + c.GetType();
            CycleInfoCPU ci = child.GetComponent <CycleInfoCPU>();



            childList.Add(ci);

            ci.parent   = p_cycleInfo;
            ci.cycle    = c;
            ci.isForm   = c is Form;
            ci.isBinder = c is Binder;
            ci.isLife   = c is Life;
            ci.count    = (c is Form) ? ((Form)c).count : 0;
            ci.parent   = p_cycleInfo;
            ci.level    = currentLevel;
            //lr.S

            id++;
            Spawn(ci, currentLevel + 1);

            cycleInfo.Add(ci);
        }

        p_cycleInfo.children = childList;

        foreach (CycleInfoCPU ci in childList)
        {
            ci.siblings = childList;
        }
    }