/// <summary> /// Updates the state of the notification moves it up and fades out as it dies. /// </summary> /// <param name="currentTime"> The current game time (Time.time) </param> public void UpdateState(float currentTime) { float timeAlive = currentTime - timeCreated_; if (timeAlive > showTime) { // fadeout float percentageComplete = (timeAlive - showTime) / fadeOutTime; notificationGroup.alpha = 1.0f - percentageComplete; if (percentageComplete > 1.0f) { isActive_ = false; } } if (isMovingUp_) { transform.localPosition = LerpExtensions.SmoothLerp( moveUpStartPosition_, moveUpEndPosition_, moveUpStartTime_, transitionUpTime, out isMovingUp_); } }
/// <summary> /// Just before rendering, updates the camera to follow the robot. /// </summary> private void LateUpdate() { if (isFollowingRobot_) { // lerped animation between 2 points. transform.position = Vector3.SmoothDamp(transform.position, new Vector3( robot.transform.position.x + cameraOffset.x, transform.position.y + cameraOffset.y, robot.transform.position.z + cameraOffset.z), ref cameraVelocity_, followSpeed ); } else if (isMovingToDistressBeacon_) { transform.position = LerpExtensions.SmoothLerp( lerpStartPosition_, initialPosition_, startTime_, logoTransitionTime, out isMovingToDistressBeacon_); if (!isMovingToDistressBeacon_) { EventManager.CameraInPosition(); } } }
// Update is called once per frame void Update() { if (isRollingCredits_) { sceneCamera.transform.position = LerpExtensions.SmoothLerp( startPosition_, endPosition_, startTime_, transitionTime_, out isRollingCredits_); if (!isRollingCredits_) { currentCamera_++; if (currentCamera_ < cameraPoints.Length) { isRollingCredits_ = true; startTime_ = Time.time; transitionTime_ = cameraPoints[currentCamera_].transitionTime; endPosition_ = cameraPoints[currentCamera_].cameraPosition.position; startPosition_ = sceneCamera.transform.position; } } } }
void Update() { if (isMoving_) { // transition between the 2 positions. doorModel.transform.position = LerpExtensions.SmoothLerp( startPosition_, endPosition_, startTime_, transitionTime, out isMoving_); } }
/// <summary> /// Scales the collectable towards the set target with lerp(smoothstep(pingpong))). /// Gives a nice dampened animation effect back and forth. /// </summary> private void PingPongScaleToTarget() { transform.localScale = LerpExtensions.SmoothPingPongLerp(pingPongScaleFrom_, pingPongScaleTo_, scaleToTargetInterval); }
/// <summary> /// Rotates the collectable towards the set target with lerp(smoothstep(pingpong))). /// Gives a nice dampened animation effect back and forth. /// </summary> private void PingPongRotateToTarget() { transform.rotation = Quaternion.Euler(LerpExtensions.SmoothPingPongLerp(pingPongRotateFrom_, pingPongRotateTo_, rotateToTargetInterval)); }
/// <summary> /// Moves the collectable towards the set target with lerp(smoothstep(pingpong))). /// Gives a nice dampened animation effect back and forth. /// </summary> private void PingPongMoveToTarget() { transform.position = LerpExtensions.SmoothPingPongLerp(pingPongMoveFrom_, pingPongMoveTo_, moveToTargetInterval); }