initial room transitioning
This commit is contained in:
+1958
-9018
File diff suppressed because it is too large
Load Diff
@@ -5,137 +5,49 @@
|
|||||||
|
|
||||||
public class CameraController : MonoBehaviour
|
public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
private bool isTracking = false; // don't track when parented
|
private float camTargetRotation = 0;
|
||||||
private bool returningHome = false; // cam is on its way home
|
private bool isCamRotating = false;
|
||||||
public float baseCamSize = 7; // this is how "zoomed" the ortho cam is
|
|
||||||
private float camMovementTime = 0.9f; // how much time to switch cam positions
|
public Transform playerCamHome;
|
||||||
|
|
||||||
private float moveSpeed;
|
private void Update()
|
||||||
private float zoomSpeed;
|
|
||||||
|
|
||||||
public Transform playerCamHome; // camera's home base
|
|
||||||
public GameObject cameraObj;
|
|
||||||
private Camera cameraComponent;
|
|
||||||
|
|
||||||
private Vector3 currentCamPosition;
|
|
||||||
private float desiredCamSize;
|
|
||||||
private int positionsSet = 0; // this keeps track of how many cam zones we're in
|
|
||||||
private float timeReturningHome = 0; // how long has the cam been moving home
|
|
||||||
|
|
||||||
private List<StaticCamRoom> roomsActive;
|
|
||||||
|
|
||||||
public void SetCurrentPosition(Vector3 currentCamPosition, float desiredCamSize)
|
|
||||||
{
|
{
|
||||||
positionsSet++; // we have entered a cam zone
|
HandleCamRotation();
|
||||||
|
}
|
||||||
|
|
||||||
if (currentCamPosition != this.currentCamPosition)
|
/// <summary>
|
||||||
|
/// Trigger cam rotation
|
||||||
|
/// </summary>
|
||||||
|
public void RotateCam()
|
||||||
|
{
|
||||||
|
if (!isCamRotating)
|
||||||
{
|
{
|
||||||
cameraObj.transform.parent = null;
|
float currentY = playerCamHome.transform.rotation.eulerAngles.y;
|
||||||
|
camTargetRotation = currentY + 90f;
|
||||||
float distanceToMove = Vector3.Distance(this.currentCamPosition, currentCamPosition);
|
isCamRotating = true;
|
||||||
float amountToZoom = Mathf.Abs(this.desiredCamSize - desiredCamSize);
|
|
||||||
moveSpeed = distanceToMove / camMovementTime;
|
|
||||||
zoomSpeed = amountToZoom / camMovementTime;
|
|
||||||
|
|
||||||
isTracking = true;
|
|
||||||
returningHome = false;
|
|
||||||
|
|
||||||
this.currentCamPosition = currentCamPosition;
|
|
||||||
this.desiredCamSize = desiredCamSize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReturnCameraToHome()
|
/// <summary>
|
||||||
|
/// Move cam to desired rotation (every frame)
|
||||||
|
/// </summary>
|
||||||
|
void HandleCamRotation()
|
||||||
{
|
{
|
||||||
positionsSet--; // we have exited a cam zone
|
float currentY = playerCamHome.transform.rotation.eulerAngles.y;
|
||||||
|
|
||||||
// if this number is greater than 1, we have left a zone but are still in another
|
float step = 200 * Time.deltaTime;
|
||||||
if (positionsSet <= 0)
|
|
||||||
|
float newY = Mathf.MoveTowardsAngle(currentY, camTargetRotation, step);
|
||||||
|
|
||||||
|
playerCamHome.RotateAround(
|
||||||
|
transform.position,
|
||||||
|
Vector3.up,
|
||||||
|
newY - currentY
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Mathf.Abs(Mathf.DeltaAngle(newY, camTargetRotation)) < 0.01f)
|
||||||
{
|
{
|
||||||
positionsSet = 0;
|
isCamRotating = false;
|
||||||
|
|
||||||
float distanceToMove = Vector3.Distance(this.currentCamPosition, playerCamHome.position);
|
|
||||||
float amountToZoom = Mathf.Abs(this.desiredCamSize - baseCamSize);
|
|
||||||
moveSpeed = distanceToMove / camMovementTime;
|
|
||||||
zoomSpeed = amountToZoom / camMovementTime;
|
|
||||||
|
|
||||||
isTracking = false;
|
|
||||||
returningHome = true;
|
|
||||||
|
|
||||||
currentCamPosition = playerCamHome.position;
|
|
||||||
desiredCamSize = baseCamSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positionsSet--;
|
|
||||||
SetCurrentPosition(roomsActive[roomsActive.Count - 1].camPosition.position, roomsActive[roomsActive.Count - 1].camZoom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddToRoomsActive(StaticCamRoom room)
|
|
||||||
{
|
|
||||||
roomsActive.Add(room);
|
|
||||||
room.RoomEnter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveFromRoomsActive(StaticCamRoom room)
|
|
||||||
{
|
|
||||||
List<Transform> wallsToKeep = new List<Transform>();
|
|
||||||
roomsActive.Remove(room);
|
|
||||||
|
|
||||||
foreach (StaticCamRoom staticCamRoom in roomsActive)
|
|
||||||
{
|
|
||||||
wallsToKeep.AddRange(staticCamRoom.objectsToHide);
|
|
||||||
}
|
|
||||||
room.RoomExit(wallsToKeep);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
cameraComponent = cameraObj.GetComponent<Camera>();
|
|
||||||
roomsActive = new List<StaticCamRoom>();
|
|
||||||
ReturnCameraToHome();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (isTracking)
|
|
||||||
{
|
|
||||||
cameraObj.transform.position = Vector3.MoveTowards(cameraObj.transform.position, currentCamPosition, Time.deltaTime * moveSpeed);
|
|
||||||
cameraComponent.orthographicSize = Mathf.MoveTowards(cameraComponent.orthographicSize, desiredCamSize, Time.deltaTime * zoomSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (returningHome)
|
|
||||||
{
|
|
||||||
currentCamPosition = playerCamHome.position;
|
|
||||||
|
|
||||||
// Speed up cam if we've been returning home longer than a certain amount
|
|
||||||
if (timeReturningHome > 1.0f)
|
|
||||||
{
|
|
||||||
cameraObj.transform.position = Vector3.MoveTowards(cameraObj.transform.position, currentCamPosition, Time.deltaTime * moveSpeed * 1.5f);
|
|
||||||
cameraComponent.orthographicSize = Mathf.MoveTowards(cameraComponent.orthographicSize, desiredCamSize, Time.deltaTime * zoomSpeed * 1.5f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cameraObj.transform.position = Vector3.MoveTowards(cameraObj.transform.position, currentCamPosition, Time.deltaTime * moveSpeed);
|
|
||||||
cameraComponent.orthographicSize = Mathf.MoveTowards(cameraComponent.orthographicSize, desiredCamSize, Time.deltaTime * zoomSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Vector3.Distance(cameraObj.transform.position, currentCamPosition) < 0.1f)
|
|
||||||
{
|
|
||||||
cameraObj.transform.parent = playerCamHome;
|
|
||||||
cameraObj.transform.localPosition = Vector3.zero;
|
|
||||||
cameraComponent.orthographicSize = baseCamSize;
|
|
||||||
returningHome = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
timeReturningHome += Time.deltaTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
timeReturningHome = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ AnimationClip:
|
|||||||
m_Curve:
|
m_Curve:
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 0
|
time: 0
|
||||||
value: {x: 0, y: -250, z: 0}
|
value: {x: 0, y: -478, z: 0}
|
||||||
inSlope: {x: 0, y: 0, z: 0}
|
inSlope: {x: 0, y: 0, z: 0}
|
||||||
outSlope: {x: 0, y: 0, z: 0}
|
outSlope: {x: 0, y: 0, z: 0}
|
||||||
tangentMode: 0
|
tangentMode: 0
|
||||||
@@ -99,7 +99,7 @@ AnimationClip:
|
|||||||
m_Curve:
|
m_Curve:
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 0
|
time: 0
|
||||||
value: -250
|
value: -478
|
||||||
inSlope: 0
|
inSlope: 0
|
||||||
outSlope: 0
|
outSlope: 0
|
||||||
tangentMode: 136
|
tangentMode: 136
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
public GameObject DougBody;
|
public GameObject DougBody;
|
||||||
public Shovel Shovel;
|
public Shovel Shovel;
|
||||||
public float walkSpeed;
|
public float walkSpeed;
|
||||||
|
public float gravity = 10;
|
||||||
|
|
||||||
float digTime = 0.9f;
|
float digTime = 0.9f;
|
||||||
float digTimestamp = 0;
|
float digTimestamp = 0;
|
||||||
@@ -16,10 +17,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
private CharacterController characterController;
|
private CharacterController characterController;
|
||||||
private CameraController cameraController;
|
private CameraController cameraController;
|
||||||
private Vector3 moveDir;
|
private Vector3 moveDir;
|
||||||
private float gravity = 10;
|
private bool hasControl = true; // set this to false if we want to stop reading player inputs
|
||||||
|
|
||||||
private float camTargetRotation = 0;
|
|
||||||
private bool isCamRotating = false;
|
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
@@ -31,24 +29,28 @@ void Start()
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (!isDigging)
|
if (hasControl)
|
||||||
{
|
{
|
||||||
RotatePlayerTowardMouse();
|
if (!isDigging)
|
||||||
TryInteract();
|
{
|
||||||
|
RotatePlayerTowardMouse();
|
||||||
|
TryInteract();
|
||||||
|
}
|
||||||
|
|
||||||
|
Walk();
|
||||||
|
DigDetector();
|
||||||
|
|
||||||
|
// TODO: This is just for testing, remove or clean up if used
|
||||||
|
if (Input.GetKeyDown(KeyCode.LeftShift))
|
||||||
|
{
|
||||||
|
cameraController.RotateCam();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Walk();
|
|
||||||
DigDetector();
|
|
||||||
|
|
||||||
// TODO: This is just for testing, remove or clean up if used
|
|
||||||
if (Input.GetKeyDown(KeyCode.LeftShift))
|
|
||||||
{
|
|
||||||
RotateCam();
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleCamRotation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle movement
|
||||||
|
/// </summary>
|
||||||
void Walk()
|
void Walk()
|
||||||
{
|
{
|
||||||
float verticalMovement = 0;
|
float verticalMovement = 0;
|
||||||
@@ -81,6 +83,9 @@ void Walk()
|
|||||||
characterController.Move(moveDir * Time.deltaTime);
|
characterController.Move(moveDir * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detect input for digging (will eventually be tool agnostic)
|
||||||
|
/// </summary>
|
||||||
void DigDetector()
|
void DigDetector()
|
||||||
{
|
{
|
||||||
if (!isDigging)
|
if (!isDigging)
|
||||||
@@ -99,8 +104,11 @@ void DigDetector()
|
|||||||
isDigging = false;
|
isDigging = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Face character graphic toward mouse
|
||||||
|
/// </summary>
|
||||||
void RotatePlayerTowardMouse()
|
void RotatePlayerTowardMouse()
|
||||||
{
|
{
|
||||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||||
@@ -118,6 +126,9 @@ void RotatePlayerTowardMouse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Try to interact by detecting nearest interactable
|
||||||
|
/// </summary>
|
||||||
void TryInteract()
|
void TryInteract()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.E) && nearestInteractable != null)
|
if (Input.GetKeyDown(KeyCode.E) && nearestInteractable != null)
|
||||||
@@ -151,33 +162,19 @@ private void OnTriggerExit(Collider other)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RotateCam()
|
/// <summary>
|
||||||
|
/// Sets the character's "hasControl" bool. All input is ignored when false
|
||||||
|
/// </summary>
|
||||||
|
public void SetCharacterControl(bool hasControl)
|
||||||
{
|
{
|
||||||
if (!isCamRotating)
|
this.hasControl = hasControl;
|
||||||
{
|
|
||||||
float currentY = cameraController.playerCamHome.transform.rotation.eulerAngles.y;
|
|
||||||
camTargetRotation = currentY + 90f;
|
|
||||||
isCamRotating = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleCamRotation()
|
/// <summary>
|
||||||
|
/// Gets the character's "hasControl" bool. All input is ignored when false
|
||||||
|
/// </summary>
|
||||||
|
public bool GetCharacterHasControl()
|
||||||
{
|
{
|
||||||
float currentY = cameraController.playerCamHome.transform.rotation.eulerAngles.y;
|
return hasControl;
|
||||||
|
|
||||||
float step = 200 * Time.deltaTime;
|
|
||||||
|
|
||||||
float newY = Mathf.MoveTowardsAngle(currentY, camTargetRotation, step);
|
|
||||||
|
|
||||||
cameraController.playerCamHome.RotateAround(
|
|
||||||
transform.position,
|
|
||||||
Vector3.up,
|
|
||||||
newY - currentY
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Mathf.Abs(Mathf.DeltaAngle(newY, camTargetRotation)) < 0.01f)
|
|
||||||
{
|
|
||||||
isCamRotating = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class RoomDoor : Interactable
|
||||||
|
{
|
||||||
|
public RoomDoor linkedDoor;
|
||||||
|
public bool requiresInteraction; // Do we need to press a button to enter?
|
||||||
|
TeleportHandler teleportHandler;
|
||||||
|
|
||||||
|
// not required and only plays if interaction is required
|
||||||
|
public Animation doorAnimator;
|
||||||
|
public AnimationClip openDoor;
|
||||||
|
public AnimationClip closeDoor;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
teleportHandler = GameObject.FindWithTag("Player").GetComponent<TeleportHandler>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Interact()
|
||||||
|
{
|
||||||
|
if (requiresInteraction)
|
||||||
|
{
|
||||||
|
if (doorAnimator && openDoor)
|
||||||
|
{
|
||||||
|
doorAnimator.clip = openDoor;
|
||||||
|
doorAnimator.Play();
|
||||||
|
}
|
||||||
|
teleportHandler.EnterRoom(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseDoor()
|
||||||
|
{
|
||||||
|
if (doorAnimator && closeDoor)
|
||||||
|
{
|
||||||
|
doorAnimator.clip = closeDoor;
|
||||||
|
doorAnimator.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MoveInsideRange()
|
||||||
|
{
|
||||||
|
if (!requiresInteraction)
|
||||||
|
{
|
||||||
|
teleportHandler.EnterRoom(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MoveOutsideRange()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f99c228d7f83ab54fb3a97a8f13fb239
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class StaticCamRoom : MonoBehaviour
|
|
||||||
{
|
|
||||||
// these will be hidden when room is entered
|
|
||||||
public Transform camPosition;
|
|
||||||
public Transform[] objectsToHide;
|
|
||||||
public float camZoom = 5f;
|
|
||||||
|
|
||||||
public void RoomEnter()
|
|
||||||
{
|
|
||||||
StopAllCoroutines();
|
|
||||||
foreach (var obj in objectsToHide)
|
|
||||||
{
|
|
||||||
StartCoroutine(FadeOutMaterial(0.5f, obj.gameObject));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RoomExit(List<Transform> wallsToKeep)
|
|
||||||
{
|
|
||||||
StopAllCoroutines();
|
|
||||||
foreach (var obj in objectsToHide)
|
|
||||||
{
|
|
||||||
if (!wallsToKeep.Contains(obj))
|
|
||||||
StartCoroutine(FadeInMaterial(0.5f, obj.gameObject));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
|
||||||
{
|
|
||||||
CameraController controller = other.gameObject.GetComponent<CameraController>();
|
|
||||||
|
|
||||||
if (controller != null)
|
|
||||||
{
|
|
||||||
controller.AddToRoomsActive(this);
|
|
||||||
controller.SetCurrentPosition(camPosition.position, camZoom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTriggerExit(Collider other)
|
|
||||||
{
|
|
||||||
CameraController controller = other.gameObject.GetComponent<CameraController>();
|
|
||||||
|
|
||||||
if (controller != null)
|
|
||||||
{
|
|
||||||
controller.RemoveFromRoomsActive(this);
|
|
||||||
controller.ReturnCameraToHome();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator FadeOutMaterial(float fadeSpeed, GameObject wallObj)
|
|
||||||
{
|
|
||||||
Renderer rend = wallObj.GetComponent<Renderer>();
|
|
||||||
Color matColor = rend.material.color;
|
|
||||||
if (matColor.a > 1f)
|
|
||||||
matColor = new Color(matColor.r, matColor.g, matColor.b, 1f);
|
|
||||||
|
|
||||||
while (rend.material.color.a > 0f)
|
|
||||||
{
|
|
||||||
matColor.a -= Time.deltaTime / fadeSpeed;
|
|
||||||
rend.material.color = matColor;
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
rend.material.color = new Color(matColor.r, matColor.g, matColor.b, 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator FadeInMaterial(float fadeSpeed, GameObject wallObj)
|
|
||||||
{
|
|
||||||
Renderer rend = wallObj.GetComponent<Renderer>();
|
|
||||||
Color matColor = rend.material.color;
|
|
||||||
|
|
||||||
while (rend.material.color.a < 1f)
|
|
||||||
{
|
|
||||||
matColor.a += Time.deltaTime / fadeSpeed;
|
|
||||||
rend.material.color = matColor;
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
rend.material.color = new Color(matColor.r, matColor.g, matColor.b, 1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 35d74944899dd8b4c9659da46cd64278
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
// Handle room and scene transitions
|
||||||
|
public class TeleportHandler : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Image blackScreenObject;
|
||||||
|
PlayerController playerController;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
playerController = GetComponent<PlayerController>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggers the room entrance coroutine, only works if the character is not controllable (keeps from double transitioning)
|
||||||
|
/// </summary>
|
||||||
|
public void EnterRoom(RoomDoor door)
|
||||||
|
{
|
||||||
|
if (playerController.GetCharacterHasControl())
|
||||||
|
StartCoroutine(EnterRoomCoroutine(door));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle teleportation and timing for entering rooms within a scene
|
||||||
|
/// </summary>
|
||||||
|
IEnumerator EnterRoomCoroutine(RoomDoor door)
|
||||||
|
{
|
||||||
|
float fadeDuration = 0.2f;
|
||||||
|
float fadeTime = 0;
|
||||||
|
Color blackScreenColor = Color.black;
|
||||||
|
|
||||||
|
playerController.SetCharacterControl(false);
|
||||||
|
// Play enter room animation (wait seconds during animation)
|
||||||
|
if (door.requiresInteraction)
|
||||||
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
|
||||||
|
blackScreenObject.gameObject.SetActive(true);
|
||||||
|
while (fadeTime < fadeDuration)
|
||||||
|
{
|
||||||
|
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
|
||||||
|
blackScreenObject.color = blackScreenColor;
|
||||||
|
fadeTime += Time.deltaTime;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
fadeTime = 0;
|
||||||
|
|
||||||
|
transform.position = door.linkedDoor.transform.position;
|
||||||
|
playerController.DougBody.transform.rotation = door.linkedDoor.transform.rotation;
|
||||||
|
|
||||||
|
while (fadeTime < fadeDuration)
|
||||||
|
{
|
||||||
|
blackScreenColor.a = Mathf.Lerp(1, 0, fadeTime / fadeDuration);
|
||||||
|
blackScreenObject.color = blackScreenColor;
|
||||||
|
fadeTime += Time.deltaTime;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
fadeTime = 0;
|
||||||
|
|
||||||
|
blackScreenObject.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
// Play exit animation for linked door (if it exists)
|
||||||
|
door.linkedDoor.CloseDoor();
|
||||||
|
yield return new WaitForSeconds(0.2f);
|
||||||
|
playerController.SetCharacterControl(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4e4075a1c9b67af429062d6dffd07682
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 59296355e319f8c47b8c7acaa657a45f
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,125 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!29 &1
|
|
||||||
OcclusionCullingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_OcclusionBakeSettings:
|
|
||||||
smallestOccluder: 5
|
|
||||||
smallestHole: 0.25
|
|
||||||
backfaceThreshold: 100
|
|
||||||
m_SceneGUID: 00000000000000000000000000000000
|
|
||||||
m_OcclusionCullingData: {fileID: 0}
|
|
||||||
--- !u!104 &2
|
|
||||||
RenderSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 10
|
|
||||||
m_Fog: 0
|
|
||||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
|
||||||
m_FogMode: 3
|
|
||||||
m_FogDensity: 0.01
|
|
||||||
m_LinearFogStart: 0
|
|
||||||
m_LinearFogEnd: 300
|
|
||||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
|
||||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
|
||||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
|
||||||
m_AmbientIntensity: 1
|
|
||||||
m_AmbientMode: 0
|
|
||||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
|
||||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_HaloStrength: 0.5
|
|
||||||
m_FlareStrength: 1
|
|
||||||
m_FlareFadeSpeed: 3
|
|
||||||
m_HaloTexture: {fileID: 0}
|
|
||||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_DefaultReflectionMode: 0
|
|
||||||
m_DefaultReflectionResolution: 128
|
|
||||||
m_ReflectionBounces: 1
|
|
||||||
m_ReflectionIntensity: 1
|
|
||||||
m_CustomReflection: {fileID: 0}
|
|
||||||
m_Sun: {fileID: 0}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
|
||||||
--- !u!157 &3
|
|
||||||
LightmapSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 13
|
|
||||||
m_BakeOnSceneLoad: 0
|
|
||||||
m_GISettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
|
||||||
m_EnableBakedLightmaps: 1
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_LightmapEditorSettings:
|
|
||||||
serializedVersion: 12
|
|
||||||
m_Resolution: 2
|
|
||||||
m_BakeResolution: 40
|
|
||||||
m_AtlasSize: 1024
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 1
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAmbientOcclusion: 0
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_TextureCompression: 1
|
|
||||||
m_ReflectionCompression: 2
|
|
||||||
m_MixedBakeMode: 2
|
|
||||||
m_BakeBackend: 2
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 512
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVREnvironmentSampleCount: 256
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_PVRFilteringMode: 1
|
|
||||||
m_PVRDenoiserTypeDirect: 1
|
|
||||||
m_PVRDenoiserTypeIndirect: 1
|
|
||||||
m_PVRDenoiserTypeAO: 1
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVREnvironmentMIS: 1
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusAO: 1
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_LightingSettings: {fileID: 0}
|
|
||||||
--- !u!196 &4
|
|
||||||
NavMeshSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_BuildSettings:
|
|
||||||
serializedVersion: 3
|
|
||||||
agentTypeID: 0
|
|
||||||
agentRadius: 0.5
|
|
||||||
agentHeight: 2
|
|
||||||
agentSlope: 45
|
|
||||||
agentClimb: 0.4
|
|
||||||
ledgeDropHeight: 0
|
|
||||||
maxJumpAcrossDistance: 0
|
|
||||||
minRegionArea: 2
|
|
||||||
manualCellSize: 0
|
|
||||||
cellSize: 0.16666667
|
|
||||||
manualTileSize: 0
|
|
||||||
tileSize: 256
|
|
||||||
buildHeightMesh: 0
|
|
||||||
maxJobWorkers: 0
|
|
||||||
preserveTilesOutsideBounds: 0
|
|
||||||
debug:
|
|
||||||
m_Flags: 0
|
|
||||||
m_NavMeshData: {fileID: 0}
|
|
||||||
--- !u!1660057539 &9223372036854775807
|
|
||||||
SceneRoots:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_Roots: []
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3e3c760154aad7c4a90627f4915e897b
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 47f0d7760444f874e8bcb58acb76e330
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b7501630d71d83a47afdce8750b0196e
|
guid: 0651f9c0ca66bb140b1209461bc72ee2
|
||||||
DefaultImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f7743426c65aebf45a5f8d5945ac0dd5
|
guid: 590cc63b33bbdf34cb9f8d8ed097b12d
|
||||||
DefaultImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 7400000
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
@@ -6,6 +6,7 @@ TagManager:
|
|||||||
tags:
|
tags:
|
||||||
- Shovel
|
- Shovel
|
||||||
- InventorySlots
|
- InventorySlots
|
||||||
|
- Door
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user