Esempio n. 1
0
        private IEnumerator InitToTrack()
        {
            if (track != null)
            {
                ChildTransformData[] childTransformData = GetChildTransforms();

                track.Connect(this);

                if (retainOriginalTransform)
                {
                    track.SnapToTrack(this, true);
                    SetChildTransforms(childTransformData);
                    yield return(new WaitForEndOfFrame());
                }

                if (setOnStart)
                {
                    track.SetPositionAlong(trackValueOnStart, this);
                }
                else
                {
                    track.SnapToTrack(this, true);
                }
                trackValue = track.GetDecimalAlong(this);
            }
        }
Esempio n. 2
0
        protected override void Awake()
        {
            base.Awake();

            if (_rigidbody)
            {
                SetGravity(true);
            }

            if (GetComponent <SphereCollider>())
            {
                colliderRadius = GetComponent <SphereCollider>().radius *transform.localScale.x;
            }

            if (track != null)
            {
                track.Connect(this);
                if (setOnStart)
                {
                    track.SetPositionAlong(trackValueOnStart, this);
                }
                else
                {
                    track.SnapToTrack(this, true);
                }
                trackValue = track.GetDecimalAlong(this);
            }
        }
Esempio n. 3
0
        private void Start()
        {
            if (track != null)
            {
                track.Connect(this);

                if (setOnStart)
                {
                    track.SetPositionAlong(trackValueOnStart, this);
                }
                else
                {
                    track.SnapToTrack(this, true);
                }
                trackValue = track.GetDecimalAlong(this);
            }
        }