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); } }
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); } }
private void Start() { if (track != null) { track.Connect(this); if (setOnStart) { track.SetPositionAlong(trackValueOnStart, this); } else { track.SnapToTrack(this, true); } trackValue = track.GetDecimalAlong(this); } }