Beispiel #1
0
        public virtual void Update()
        {
            int num = 0;

            for (int i = 0, imax = m_Fists.Length; i < imax; ++i)
            {
                if (children[i] != null && m_Fists[i] != null)
                {
                    if ((m_Fists[i].position - children[i].position).sqrMagnitude <= childSize * childSize)
                    {
                        ++num;
                        // Invoke events.
                        if (!m_ChildIsReady[i])
                        {
                            // Trigger a vibration to notify users this controller is ready.
                            ControllerInput input = ControllerInputManager.instance.GetControllerInput(ControllerType.LeftController + i);
                            if (input != null)
                            {
                                input.StartVibration(0, 0.25f);
                            }
                            /*...*/
                            if (m_ChildReadyObjects[i] != null)
                            {
                                if (string.IsNullOrEmpty(childReadyMsg))
                                {
                                    m_ChildReadyObjects[i].SetActive(true);
                                }
                                else
                                {
                                    m_ChildReadyObjects[i].SendMessage(childReadyMsg, true, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                        }
                        //
                        m_ChildIsReady[i] = true;
                    }
                    else
                    {
                        // Invoke events.
                        if (m_ChildIsReady[i])
                        {
                            /*...*/
                            if (m_ChildReadyObjects[i] != null)
                            {
                                if (string.IsNullOrEmpty(childReadyMsg))
                                {
                                    m_ChildReadyObjects[i].SetActive(false);
                                }
                                else
                                {
                                    m_ChildReadyObjects[i].SendMessage(childReadyMsg, false, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                        }
                        //
                        m_ChildIsReady[i] = false;
                    }
                }
            }
            if (num == m_Fists.Length || buttonSkip.GetAny())
            {
                // TODO:
                TrackerInput trackerInput = TrackerInput.Find(null);
                if (trackerInput != null)
                {
                    trackerInput.Recenter();
                }
                //
                StopListen();
                if (onStart != null)
                {
                    onStart();
                }
            }
        }