fix quest bug checking wrong conditions

This commit is contained in:
2026-04-11 22:04:39 -05:00
parent 54db4e4b73
commit 77625e7ad5
5 changed files with 103 additions and 5 deletions
+76
View File
@@ -57,6 +57,81 @@ private void ReloadReferences()
Instance.PlayerManager = GetComponent<PlayerManager>();
}
#region Map Load Handling
/// <summary>
/// Triggers transition to a map point
/// </summary>
public void GoToMapPoint(MapPoint mapPoint)
{
StartCoroutine(GoToMapPointCoroutine(mapPoint));
}
/// <summary>
/// Executes transition to map point (scene and location)
/// </summary>
private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
{
Instance.isTransitioningScenes = true;
Instance.playerController.SetCharacterControl(false);
// Fade to black
float fadeDuration = 0.2f; // how long to fade to/from black
float moveDuration = 0.4f; // how long to auto walk into room from the door
float fadeTime = 0;
Color blackScreenColor = Color.black;
while (fadeTime < fadeDuration)
{
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
blackScreen.color = blackScreenColor;
fadeTime += Time.deltaTime;
yield return null;
}
fadeTime = 0;
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(mapPoint.Scene);
while (!asyncLoad.isDone)
{
// Optional: Update a loading bar with asyncLoad.progress
yield return null;
}
ReloadReferences();
// Make sure screen is black in new scene
blackScreen.color = blackScreenColor;
if (Instance.playerController != null && GameSceneManager.Instance != null)
{
Instance.playerController.CharacterControllerMove(mapPoint.SpawnPosition - playerController.transform.position);
}
// Fade back in
while (fadeTime < fadeDuration)
{
blackScreenColor.a = Mathf.Lerp(1, 0, fadeTime / fadeDuration);
Instance.blackScreen.color = blackScreenColor;
fadeTime += Time.deltaTime;
yield return null;
}
// move character a little more
while (fadeTime < moveDuration)
{
fadeTime += Time.deltaTime;
yield return null;
}
fadeTime = 0;
Instance.isTransitioningScenes = false;
Instance.playerController.SetCharacterControl(true);
}
#endregion
#region Scene Door Handling
/// <summary>
/// Triggers transition to specified scene at the door with the specified ID
/// </summary>
@@ -136,6 +211,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
Instance.isTransitioningScenes = false;
Instance.playerController.SetCharacterControl(true);
}
#endregion
/// <summary>
/// Are we currently in the middle of a scene transition?