Esempio n. 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;
        }
Esempio n. 2
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;*/
        }