Пример #1
0
        protected override void Sync()
        {
            //Debug.Log(Lookon.Count);
            bool follow = false;

            //controller_index = -1;
            //state = 0;
            if (Lookon.Count > 0)
            {
                state = 1;
            }
            else
            {
                state = 0;
            }

            foreach (Phonecontroller c in Controllers)
            {
                controller_index = -1;
                if (c.transform.position.z > 0.1)
                {
                    controller_index = c.index;
                    Curbutton        = c;
                    break;
                }
            }
            foreach (Actor a in Lookon)
            {
                if ((int)a.trackingTag == controller_index)
                {
                    follow = true;
                    cursor = a.gameObject;
                    state  = 2;
                }
            }
            if (sending)
            {
                synchronizedInt = state;
                if (follow)
                {
                    transform.position  = cursor.GetComponent <IkeaCursor>().CursorLocation;
                    synchronizedVector3 = transform.position;
                    //synchronizedQuaternion = transform.rotation;
                }
                synchronizedVector3 = transform.position;
            }
            if (!useMasterPC)
            {
                transform.position = synchronizedVector3;
                state = synchronizedInt;
            }

            //Debug.Log(controller_index);
            Debug.Log(state);
        }
Пример #2
0
 private void SetController(Actor act, int ind)
 {
     Transform[] ts = act.gameObject.transform.GetComponentsInChildren <Transform>(true);
     foreach (Transform t in ts)
     {
         if (t.gameObject.name == "Controller")
         {
             Phonecontroller ph = t.gameObject.GetComponent <Phonecontroller>();
             ph.label            = Pcontroller.GetName((Pcontroller.Tag)ind);
             ph.index            = ind;
             ph.transform.parent = transform;
         }
     }
 }