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
+9 -1
View File
@@ -1753,7 +1753,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.0007883741, y: 0.0012165046, z: -0.0015583121, w: 0.99999774} m_LocalRotation: {x: -0.0007883741, y: 0.0012165046, z: -0.0015583121, w: 0.99999774}
m_LocalPosition: {x: 10.801, y: 3.6573, z: 4.404} m_LocalPosition: {x: 10.801, y: 3.6573, z: 4.404}
m_LocalScale: {x: 0.12264277, y: 0.12264277, z: 0.12264277} m_LocalScale: {x: 0.19202179, y: 0.19202179, z: 0.19202179}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1843688239} - {fileID: 1843688239}
@@ -8391,6 +8391,14 @@ PrefabInstance:
propertyPath: 'tools.Array.data[3]' propertyPath: 'tools.Array.data[3]'
value: value:
objectReference: {fileID: 373047378} objectReference: {fileID: 373047378}
- target: {fileID: 2715587763268303228, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
propertyPath: m_Lightmapping
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5056434560497563343, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
propertyPath: m_LocalPosition.y
value: -0.78
objectReference: {fileID: 0}
- target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3} - target: {fileID: 5526037850913171920, guid: 0fd9b22e9158e474a96c42de5ee0d85f, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -0.60945 value: -0.60945
+76
View File
@@ -57,6 +57,81 @@ private void ReloadReferences()
Instance.PlayerManager = GetComponent<PlayerManager>(); 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> /// <summary>
/// Triggers transition to specified scene at the door with the specified ID /// Triggers transition to specified scene at the door with the specified ID
/// </summary> /// </summary>
@@ -136,6 +211,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
Instance.isTransitioningScenes = false; Instance.isTransitioningScenes = false;
Instance.playerController.SetCharacterControl(true); Instance.playerController.SetCharacterControl(true);
} }
#endregion
/// <summary> /// <summary>
/// Are we currently in the middle of a scene transition? /// Are we currently in the middle of a scene transition?
+10
View File
@@ -0,0 +1,10 @@
using UnityEngine;
// Gives a location to be teleported to and displayed on a map. This will be used by
// the game manager to allow for fast travel
[System.Serializable]
public class MapPoint
{
public string Scene;
public Vector3 SpawnPosition;
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5c03ccad2a919f74d95b0d3a409412b9
@@ -60,12 +60,12 @@ private void Awake()
QuestBool[] QID2_List = new QuestBool[1]; QuestBool[] QID2_List = new QuestBool[1];
// QID2_1_completedQuest3 // QID2_1_completedQuest3
QID1_List[0] = new QuestBool(() => QID2_List[0] = new QuestBool(() =>
{ {
return CompletedQuests.Contains(3); return CompletedQuests.Contains(3);
}); });
questBoolMap.Add(2, QID1_List); questBoolMap.Add(2, QID2_List);
#endregion #endregion
#region 3 - (Story Quest #1.5) First Paycheck #region 3 - (Story Quest #1.5) First Paycheck
@@ -75,17 +75,18 @@ private void Awake()
QuestBool[] QID3_List = new QuestBool[1]; QuestBool[] QID3_List = new QuestBool[1];
// QID3_1_hasEnoughStarshards // QID3_1_hasEnoughStarshards
QID1_List[0] = new QuestBool(() => QID3_List[0] = new QuestBool(() =>
{ {
return GameManager.Instance.Inventory.GetItemQuantity(ItemIdEnum.STAR_SHARD) > 0; return GameManager.Instance.Inventory.GetItemQuantity(ItemIdEnum.STAR_SHARD) > 0;
}); });
questBoolMap.Add(3, QID1_List); questBoolMap.Add(3, QID3_List);
#endregion #endregion
return questBoolMap; return questBoolMap;
} }
#region Save/Load Quest Data
// Save completed quests to disk // Save completed quests to disk
public void SaveQuestData(ref QuestSaveData data) public void SaveQuestData(ref QuestSaveData data)
{ {
@@ -113,6 +114,7 @@ public void LoadQuestData(QuestSaveData data)
Instance.CompletedQuests = new List<int>(); Instance.CompletedQuests = new List<int>();
} }
} }
#endregion
} }
public class QuestBool public class QuestBool