コード例 #1
0
        public void Add()
        {
            if (actor == null)
            {
                Debug.LogWarning("ActorInstantiator: Actor reference is null!");
                return;
            }
            for (int i = 0; i < amount; ++i)
            {
                Actor a = (Instantiate(actor.gameObject, Vector3.zero, Quaternion.identity) as GameObject).GetComponent <Actor>();
                a.transform.parent = transform;

                //Set tag and color automatically
                int index = (i + GetComponent <ActorManager>().actors.Length) % Motive.tagCount;
                a.trackingTag = (Motive.Tag)index;
                a.handle      = handles[i % handles.Length];
                a.motif       = colors[i % colors.Length];

                //HoloIK-specific settings
                HoloIK ik = a.GetComponentInChildren <HoloIK>();
                if (ik != null)
                {
                    ik.groundPlane = groundPlane;
                }
            }
            GetComponent <ActorManager>().Update();
        }
コード例 #2
0
        public void Add()
        {
            if (actor == null)
            {
                Debug.LogWarning("ActorInstantiator: Actor reference is null!");
                return;
            }
            for (int i = 0; i < amount; ++i)
            {
                Actor a = (Instantiate(actor.gameObject, Vector3.zero, Quaternion.identity) as GameObject).GetComponent <Actor>();
                a.transform.parent = transform;



                //Set tag and color automatically
                int index = (i + GetComponent <ActorManager>().actors.Length) % Motive.tagCount;

                //Wenbo Edit for Ikea Demo
                // phonecontroller = Resources.Load("/Holojam/Demo/Prefabs/PhoneController") as Phonecontroller;
                // Phonecontroller ph = (Instantiate(phonecontroller.gameObject, Vector3.zero, Quaternion.identity) as GameObject).GetComponent<Phonecontroller>();
                //  ph.label = Pcontroller.GetName((Pcontroller.Tag)index);
                // ph.transform.parent = a.transform;
                //Wenbo Edit for Ikea Demo

                a.trackingTag = (Motive.Tag)index;
                a.handle      = handles[i % handles.Length];
                a.motif       = colors[i % colors.Length];
                SetController(a, index);
                //HoloIK-specific settings
                HoloIK ik = a.GetComponentInChildren <HoloIK>();
                if (ik != null)
                {
                    ik.groundPlane = groundPlane;
                }
            }
            GetComponent <ActorManager>().Update();
        }