Exemple #1
0
        void GenerateNewTrailElement()
        {
            m_CurrentDisplacement -= m_ZMoveStep;
            if (m_CurrentDisplacement <= m_ZMoveStep)
            {
                m_CurrentDisplacement = m_ZMoveMax;
            }
            TrailElement _TmpElement = TrailElement.GetFreeElement();

            //GameObject _tmpGo = GameObject.Instantiate(m_TrailElementPrefab);
            //_tmpGo.name = "TRAIL_" + m_SpriteToDuplicate.name;
            //_tmpGo.hideFlags = HideFlags.None;
            //_tmpGo.transform.Equals(m_SpriteToDuplicate.transform);
            _TmpElement.m_Transform.SetParent(m_SpriteToDuplicate.transform, true);
            _TmpElement.m_Transform.localScale    = new Vector3(1, 1, 1);
            _TmpElement.m_Transform.localRotation = Quaternion.identity;
            _TmpElement.m_Transform.localPosition = Vector3.zero;
            if (m_TrailParent == null)
            {
                _TmpElement.m_Transform.SetParent(GlobalTrailContainer, true);
            }
            else
            {
                _TmpElement.m_Transform.SetParent(m_LocalTrailContainer, true);
            }
            Vector3 _NewPos = _TmpElement.transform.position;

            _NewPos.z = m_CurrentDisplacement;
            _TmpElement.m_Transform.position = _NewPos;
            _TmpElement.Initialise(this);
            _TmpElement.m_myGameObject.layer = m_Layer;
        }
Exemple #2
0
        private TrailElement GetTrailElement()
        {
            if (m_TrailElement != null)
            {
                return(m_TrailElement);
            }

            return(m_TrailElement = GetComponent <TrailElement>());
        }
Exemple #3
0
        void GenerateNewTrailElement(Vector3 pos)
        {
            m_CurrentDisplacement -= m_ZMoveStep;
            if (m_CurrentDisplacement <= m_ZMoveStep)
            {
                m_CurrentDisplacement = m_ZMoveMax;
            }
            TrailElement _TmpElement = TrailElement.GetFreeElement();

            //GameObject _tmpGo = GameObject.Instantiate(m_TrailElementPrefab);
            //_tmpGo.name = "TRAIL_" + m_SpriteToDuplicate.name;
            //_tmpGo.hideFlags = HideFlags.None;
            //_tmpGo.transform.Equals(m_SpriteToDuplicate.transform);
            _TmpElement.m_Transform.SetParent(m_SpriteToDuplicate.transform, true);
            _TmpElement.m_Transform.localScale    = new Vector3(1, 1, 1);
            _TmpElement.m_Transform.localRotation = Quaternion.identity;
            _TmpElement.m_Transform.localPosition = Vector3.zero;
            if (m_TrailParent == null)
            {
                _TmpElement.m_Transform.SetParent(m_GlobalTrailContainer, true);
            }
            else
            {
                _TmpElement.m_Transform.SetParent(m_LocalTrailContainer, true);
            }
            Vector3 _NewPos = pos;

            _NewPos.z += m_CurrentDisplacement;
            _TmpElement.m_Transform.position = _NewPos;
            _TmpElement.Initialise(this);
            _TmpElement.m_myGameObject.layer          = m_Layer;
            _TmpElement.SpriteRenderer.sortingLayerID = m_SortingLayerID;
            _TmpElement.SpriteRenderer.sortingOrder   = m_OrderInSortingLayer;

            /*m_CurrentDisplacement -= m_ZMoveStep;
             * if (m_CurrentDisplacement <= m_ZMoveStep)
             * m_CurrentDisplacement = m_ZMoveMax;
             * TrailElement trail = TrailElement.GetFreeElement();
             * trail.m_Transform.localScale = new Vector3(1, 1, 1);
             * trail.m_Transform.localRotation = Quaternion.identity;
             * trail.m_Transform.localPosition = Vector3.zero;
             * if (m_TrailParent != null) {
             * trail.m_Transform.SetParent(m_LocalTrailContainer, true);
             * }
             *
             * Vector3 newPos = pos;
             * newPos.z += m_CurrentDisplacement;
             * trail.m_Transform.position = newPos;
             * trail.Initialise(this);
             * trail.gameObject.layer = m_Layer;
             * trail.SpriteRenderer.sortingLayerID = m_SortingLayerID;
             * trail.SpriteRenderer.sortingOrder = m_OrderInSortingLayer;*/
        }
Exemple #4
0
 /// <summary>
 /// Hide the current trail, delete all trails elements in this trail.
 /// </summary>
 public void HideTrail(bool addToFree)
 {
     m_DisabledElementsInTrail.Clear();
     while (m_ElementsInTrail.Count > 0)
     {
         TrailElement e = m_ElementsInTrail.Dequeue();
         if (e != null)
         {
             e.Hide(addToFree);
             if (!addToFree)
             {
                 m_DisabledElementsInTrail.Add(e);
             }
         }
     }
 }
Exemple #5
0
 private static void OnSceneUnloaded(Scene scene)
 {
     TrailElement.RefreshFreeElements();
 }