public void PositionChanged() { if (!CameraPath.isPlaying) { CameraPath.Seek(PathPosition); } }
//PRIVATE METHODS protected virtual void PlayNextAnimation() { if (_cameraPath.nextPath != null) { CameraPathAnimator _animator = _cameraPath.nextPath.GetComponent <CameraPathAnimator>(); float nextPercent = _cameraPath.interpolateNextPath ? _percentage % 1 : 0; _animator.Seek(nextPercent); _animator.Play(); Stop(); } }
private void PlayNextAnimation() { if (this._cameraPath.nextPath != null) { CameraPathAnimator component = this._cameraPath.nextPath.GetComponent <CameraPathAnimator>(); float value = (!this._cameraPath.interpolateNextPath) ? 0f : (this._percentage % 1f); component.Seek(value); component.Play(); this.Stop(); } }
public bool PlayCPA() { if (mCpa == null || mCpa.isPlaying) { return(false); } mCpa.gameObject.SetActive(true); mCpa.Seek(mPercent); mCpa.Play(); PauseMove = true; PauseRoll = true; return(true); }
public void startCamera() { cameras [index].gameObject.SetActive(true); // enable touch in vr //Cardboard.SDK.TapIsTrigger = false; CameraPathAnimator cpa = camerapath.GetComponent <CameraPathAnimator> (); cpa.animationObject = cameras [index]; cpa.Seek(startPositions[index]); cpa.Play(); // switch on vr, switch off canvas //Cardboard.SDK.TapIsTrigger = true; gameObject.SetActive(false); //initialize rest initializeGameObject(); }
void OnGUI() { if (pathAnimator == null) { return; } GUILayout.BeginVertical("Box", GUILayout.Width(250)); GUILayout.BeginHorizontal(); if (!pathAnimator.isPlaying) { if (GUILayout.Button("REPLAY", GUILayout.Width(70))) { if (pathAnimator.animationMode != CameraPathAnimator.animationModes.reverse) { pathAnimator.Seek(0); } else { pathAnimator.Seek(1); } pathAnimator.Play(); } } else { if (GUILayout.Button("START", GUILayout.Width(70))) { pathAnimator.Play(); } if (GUILayout.Button("PAUSE", GUILayout.Width(70))) { pathAnimator.Pause(); } if (GUILayout.Button("STOP", GUILayout.Width(60))) { pathAnimator.Stop(); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Current Animation Percentage " + (pathAnimator.percentage * 100).ToString("F1") + "%", GUILayout.Width(150)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Path: " + pathAnimator.gameObject.name); if (GUILayout.Button("SWITCH", GUILayout.Width(70))) { pathAnimator.Stop(); if (pathAnimator == pathAnimatorA) { pathAnimator = pathAnimatorB; } else { pathAnimator = pathAnimatorA; } pathAnimator.Play(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Seek to Percent " + (seekTo * 100).ToString("F1") + "%", GUILayout.Width(150)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); seekTo = GUILayout.HorizontalSlider(seekTo, 0, 1); if (GUILayout.Button("Seek", GUILayout.Width(40))) { pathAnimator.Stop(); pathAnimator.Seek(seekTo); pathAnimator.Play(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Animation Mode:"); GUILayout.Label(pathAnimator.animationMode.ToString()); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Orientation Mode:"); GUILayout.Label(pathAnimator.orientationMode.ToString()); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); if (GUILayout.Button("Forward")) { pathAnimator.animationMode = CameraPathAnimator.animationModes.once; } if (GUILayout.Button("Reverse")) { pathAnimator.animationMode = CameraPathAnimator.animationModes.reverse; } if (GUILayout.Button("Loop")) { pathAnimator.animationMode = CameraPathAnimator.animationModes.loop; } if (GUILayout.Button("Reverse Loop")) { pathAnimator.animationMode = CameraPathAnimator.animationModes.reverseLoop; } if (GUILayout.Button("Ping Pong")) { pathAnimator.animationMode = CameraPathAnimator.animationModes.pingPong; } GUILayout.EndVertical(); GUILayout.BeginVertical(); if (GUILayout.Button("Custom")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.custom; } if (GUILayout.Button("Mouse look")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.mouselook; } if (GUILayout.Button("Follow Path")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.followpath; } if (GUILayout.Button("Reverse Follor Path")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.reverseFollowpath; } if (GUILayout.Button("CameraPathOnRailsTarget")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.target; } if (GUILayout.Button("Follow Transform")) { pathAnimator.orientationMode = CameraPathAnimator.orientationModes.followTransform; } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }