This script handles changing the camera and moving the player to the new "Time".
Start():
This function finds the player by checking for a GameObject with the tag "Player".
It then sets itself to an Instance.
TimeTravel(Camera oldCamera, Camera, newCamera, float travelLocation):
This script is called by PortalInterface.cs
This function starts the TransitionUI(Camera oldCamera, Camera newCamera, float travelLocation) coroutine.
IEnumerator TransitionUI(Camera oldCamera, Camera newCamera, float travelLocation):
This function handles the UI for the time travel effect, changing the cameras and moving the player.
It starts by enabling the fadeUI and playing the "FadeInAnim".
It then waits for 0.4 seconds which is 0.1 seconds longer than the animation.
The coroutine then enables the newCamera and disables the oldCamera.
It then moves the player to the same position it is currently at but now adds travelLocation to the X axis to simulate traveling through time.
Then, it fades the fadeUI out with the "FadeOutAnim", waits for 0.4 seconds which is 0.1 seconds longer than the animation and then disables the fadeUI.
Comments
Post a Comment