Ejemplo n.º 1
0
        public void toggleIndicatorPrefab()
        {
            Transform tmp = backupPrefab;

            backupPrefab    = indicatorPrefab;
            indicatorPrefab = tmp;

            // Now change all exist object.
            List <IDistanceIndicator> newlist = new List <IDistanceIndicator>(m_indicators.Count);

            foreach (IDistanceIndicator idi in m_indicators)
            {
                Destroy(idi.gameObject);
                Transform newobj = Instantiate <Transform>(indicatorPrefab);
                newobj.gameObject.SetActive(false);
                IDistanceIndicator nidi = newobj.GetComponent <IDistanceIndicator>();
                nidi.UpdateConfig(m_configs);
                newlist.Add(nidi);
            }
            m_indicators.Clear();
            m_indicators = newlist;

            // Now refresh collider list
            m_trackingObjects.Clear();
        }
Ejemplo n.º 2
0
        void BindIndicatorToObject(Collider cd)
        {
            // Find an available indicator
            for (int i = 0; i < m_indicators.Count; ++i)
            {
                if (m_indicators[i].gameObject.activeInHierarchy == false)
                {
                    // use this
                    m_indicators[i].SetToAnInteractiveObject(cd.transform);
                    m_trackingObjects.Add(cd, m_indicators[i]);
                    return;
                }
            }

            // Or no available indicator, create one
            Transform          t  = GameObject.Instantiate(indicatorPrefab);
            IDistanceIndicator di = t.GetComponent <IDistanceIndicator>();

            if (di == null)
            {
                GameObject.Destroy(t.gameObject);
                return;
            }

            di.UpdateConfig(m_configs);
            di.SetToAnInteractiveObject(cd.transform);
            m_trackingObjects.Add(cd, di);
            m_indicators.Add(di);
        }
Ejemplo n.º 3
0
        void setSoundPlayForIndicator(IDistanceIndicator indi, bool play)
        {
            bool preValue = m_configs.useSound;

            m_configs.useSound = play;
            indi.UpdateConfig(m_configs);
            m_configs.useSound = preValue;
        }