|
|
|
@@ -44,13 +44,12 @@ private void Awake()
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void ReloadReferences()
|
|
|
|
|
{
|
|
|
|
|
blackScreen = GameObject.FindWithTag("BlackScreen").GetComponent<Image>();
|
|
|
|
|
playerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
|
|
|
|
|
DialogueManager = GetComponent<DialogueManager>();
|
|
|
|
|
DialogueManager.ReloadReferences();
|
|
|
|
|
|
|
|
|
|
Inventory = GetComponent<Inventory>();
|
|
|
|
|
Instance.blackScreen = GameObject.FindWithTag("BlackScreen").GetComponent<Image>();
|
|
|
|
|
Instance.playerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
|
|
|
|
|
Instance.DialogueManager = GetComponent<DialogueManager>();
|
|
|
|
|
Instance.DialogueManager.ReloadReferences();
|
|
|
|
|
|
|
|
|
|
Instance.Inventory = GetComponent<Inventory>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@@ -66,8 +65,8 @@ public void EnterSceneDoor(string scene, int door)
|
|
|
|
|
/// </summary>
|
|
|
|
|
private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
|
|
|
|
{
|
|
|
|
|
isTransitioningScenes = true;
|
|
|
|
|
playerController.SetCharacterControl(false);
|
|
|
|
|
Instance.isTransitioningScenes = true;
|
|
|
|
|
Instance.playerController.SetCharacterControl(false);
|
|
|
|
|
|
|
|
|
|
// Fade to black
|
|
|
|
|
float fadeDuration = 0.2f; // how long to fade to/from black
|
|
|
|
@@ -99,12 +98,12 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
|
|
|
|
|
|
|
|
|
SceneDoor door = GameSceneManager.Instance.GetDoorWithId(doorId);
|
|
|
|
|
|
|
|
|
|
if (playerController != null && GameSceneManager.Instance != null)
|
|
|
|
|
if (Instance.playerController != null && GameSceneManager.Instance != null)
|
|
|
|
|
{
|
|
|
|
|
if (door != null)
|
|
|
|
|
{
|
|
|
|
|
playerController.CharacterControllerMove(door.gameObject.transform.position - playerController.transform.position);
|
|
|
|
|
playerController.DougBody.transform.rotation = door.gameObject.transform.rotation;
|
|
|
|
|
Instance.playerController.CharacterControllerMove(door.gameObject.transform.position - playerController.transform.position);
|
|
|
|
|
Instance.playerController.DougBody.transform.rotation = door.gameObject.transform.rotation;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -112,25 +111,25 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
|
|
|
|
while (fadeTime < fadeDuration)
|
|
|
|
|
{
|
|
|
|
|
blackScreenColor.a = Mathf.Lerp(1, 0, fadeTime / fadeDuration);
|
|
|
|
|
blackScreen.color = blackScreenColor;
|
|
|
|
|
Instance.blackScreen.color = blackScreenColor;
|
|
|
|
|
fadeTime += Time.deltaTime;
|
|
|
|
|
|
|
|
|
|
playerController.WalkInDirection((door.WalkDirection.position - playerController.transform.position).normalized);
|
|
|
|
|
Instance.playerController.WalkInDirection((door.WalkDirection.position - playerController.transform.position).normalized);
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// move character a little more
|
|
|
|
|
while (fadeTime < moveDuration)
|
|
|
|
|
{
|
|
|
|
|
playerController.WalkInDirection((door.WalkDirection.position - playerController.transform.position).normalized);
|
|
|
|
|
Instance.playerController.WalkInDirection((door.WalkDirection.position - playerController.transform.position).normalized);
|
|
|
|
|
fadeTime += Time.deltaTime;
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fadeTime = 0;
|
|
|
|
|
|
|
|
|
|
isTransitioningScenes = false;
|
|
|
|
|
playerController.SetCharacterControl(true);
|
|
|
|
|
Instance.isTransitioningScenes = false;
|
|
|
|
|
Instance.playerController.SetCharacterControl(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@@ -138,7 +137,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool InSceneTransition()
|
|
|
|
|
{
|
|
|
|
|
return isTransitioningScenes;
|
|
|
|
|
return Instance.isTransitioningScenes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Storybool Save/Load
|