/// <summary> /// Returns children transforms, sorted by name. /// </summary> public void RefreshTransforms(float speed) { if (speed <= 0f) { speed = 1f; } if (Points != null) { completeDuration = 0; //create parabolas for (int i = 0; i < parabolas.Length; i++) { if (parabolas[i] == null) { parabolas[i] = new Parabola3D(); } parabolas[i].Set(Points[i * 2].position, Points[i * 2 + 1].position, Points[i * 2 + 2].position); partDuration[i] = parabolas[i].Length / speed; completeDuration += partDuration[i]; } } }
/// <summary> /// Returns children transforms, sorted by name. /// </summary> public void RefreshTransforms(float speed) { if (speed <= 0f) { speed = 1f; } if (Points != null) { completeDuration = 0; //create parabolas for (int i = 0; i < parabolas.Length; i++) { if (parabolas[i] == null) { parabolas[i] = new Parabola3D(); } if (parent.player) { int direction = parent.player.facingDirection == PlayerMovement.FacingDirection.LEFT ? -1 : 1; Vector3 scale = new Vector3(parent.parabolaScale * direction, 1, 1); parabolas[i].Set(Points[i * 2].position, Points[i * 2 + 1].position + scale, Points[i * 2 + 2].position + scale); partDuration[i] = parabolas[i].Length / speed; completeDuration += partDuration[i]; } else { parabolas[i].Set(Points[i * 2].position, Points[i * 2 + 1].position, Points[i * 2 + 2].position); partDuration[i] = parabolas[i].Length / speed; completeDuration += partDuration[i]; } } } }