Compare commits

...

2 Commits

12 changed files with 2341 additions and 63 deletions
+13
View File
@@ -438,6 +438,7 @@ GameObject:
- component: {fileID: 7681847596368765025} - component: {fileID: 7681847596368765025}
- component: {fileID: 4444498079052879519} - component: {fileID: 4444498079052879519}
- component: {fileID: 5173819118098093347} - component: {fileID: 5173819118098093347}
- component: {fileID: 1410439939888368689}
m_Layer: 0 m_Layer: 0
m_Name: GameManager m_Name: GameManager
m_TagString: Untagged m_TagString: Untagged
@@ -560,3 +561,15 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerManager m_EditorClassIdentifier: Assembly-CSharp::PlayerManager
CurrentToolIndex: 0 CurrentToolIndex: 0
--- !u!114 &1410439939888368689
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8685480739473632986}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab14394efecbd6540af369ced75e81d0, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::SoundSettingManager
+9
View File
@@ -3,10 +3,13 @@
public class PauseMenu : MonoBehaviour public class PauseMenu : MonoBehaviour
{ {
public Button SettingsButton;
public Button SaveButton; public Button SaveButton;
public Button DeleteSaveButton; public Button DeleteSaveButton;
public Button QuitButton; public Button QuitButton;
public GameObject SettingsMenu;
public void ReloadReferences() public void ReloadReferences()
{ {
// pull all game objs here // pull all game objs here
@@ -14,6 +17,7 @@ public void ReloadReferences()
void Start() void Start()
{ {
SettingsButton.onClick.AddListener(ShowSettings);
SaveButton.onClick.AddListener(SaveSystem.Save); SaveButton.onClick.AddListener(SaveSystem.Save);
DeleteSaveButton.onClick.AddListener(SaveSystem.ClearSave); DeleteSaveButton.onClick.AddListener(SaveSystem.ClearSave);
} }
@@ -22,4 +26,9 @@ void Update()
{ {
} }
void ShowSettings()
{
SettingsMenu.SetActive(true);
}
} }
+60 -41
View File
@@ -2984,17 +2984,6 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1286273673} m_GameObject: {fileID: 1286273673}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &1299342542 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7112063300641303959, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
--- !u!1 &1316688875 --- !u!1 &1316688875
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -3149,17 +3138,6 @@ Transform:
- {fileID: 813193272} - {fileID: 813193272}
m_Father: {fileID: 265036979} m_Father: {fileID: 265036979}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1366274845 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1356069847872831277, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
--- !u!1 &1378316137 --- !u!1 &1378316137
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -3860,6 +3838,17 @@ Transform:
- {fileID: 2146681817} - {fileID: 2146681817}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1889534305 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 249075524138301096, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
--- !u!1 &1892268938 --- !u!1 &1892268938
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -4156,17 +4145,6 @@ Transform:
- {fileID: 441147620} - {fileID: 441147620}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2079108456 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4694531887666682614, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button
--- !u!1 &2146681811 --- !u!1 &2146681811
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -4408,10 +4386,46 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 1704696510} m_TransformParent: {fileID: 1704696510}
m_Modifications: m_Modifications:
- target: {fileID: 818899427131401759, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1376587328550839904, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3} - target: {fileID: 1376587328550839904, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: UI value: UI
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2975696880262954876, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3851509619645923519, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4155624016714589187, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchoredPosition.y
value: -201
objectReference: {fileID: 0}
- target: {fileID: 4264548731807291060, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4666577222808766051, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchoredPosition.y
value: -330.1
objectReference: {fileID: 0}
- target: {fileID: 4906462856215206936, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchoredPosition.y
value: -76
objectReference: {fileID: 0}
- target: {fileID: 5101319162034548862, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5514935285560916770, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6792308726050395253, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3} - target: {fileID: 6792308726050395253, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0 value: 0
@@ -4452,18 +4466,18 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7535213278904715570, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3} - target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: QuitButton propertyPath: SettingsMenu
value: value:
objectReference: {fileID: 2079108456} objectReference: {fileID: 6325623361260993109}
- target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3} - target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: SaveButton propertyPath: SettingsButton
value: value:
objectReference: {fileID: 1366274845} objectReference: {fileID: 1889534305}
- target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
propertyPath: DeleteSaveButton
value:
objectReference: {fileID: 1299342542}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -4474,6 +4488,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6792308726050395253, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3} m_CorrespondingSourceObject: {fileID: 6792308726050395253, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107} m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &6325623361260993109 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3851509619645923519, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
m_PrefabInstance: {fileID: 6325623361260993107}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7959480261809233915 --- !u!1001 &7959480261809233915
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+30 -11
View File
@@ -15,6 +15,7 @@ public class GameManager : MonoBehaviour
public Inventory Inventory { get; private set; } public Inventory Inventory { get; private set; }
public Storybools Storybools { get; private set; } public Storybools Storybools { get; private set; }
public PauseMenu PauseMenu { get; private set; } public PauseMenu PauseMenu { get; private set; }
public SoundSettingManager SoundSettingManager { get; private set; }
public PlayerController PlayerController { get; private set; } public PlayerController PlayerController { get; private set; }
public Image BlackScreen { get; private set; } public Image BlackScreen { get; private set; }
@@ -44,7 +45,6 @@ private void Awake()
private void Start() private void Start()
{ {
SaveSystem.Load(); SaveSystem.Load();
SaveSystem.Save(); // save off any corruption fixes
} }
/// <summary> /// <summary>
@@ -64,21 +64,24 @@ private void ReloadReferences()
Instance.Inventory = GetComponent<Inventory>(); Instance.Inventory = GetComponent<Inventory>();
Instance.TimeManager = GetComponent<TimeManager>(); Instance.TimeManager = GetComponent<TimeManager>();
Instance.PlayerManager = GetComponent<PlayerManager>(); Instance.PlayerManager = GetComponent<PlayerManager>();
Instance.SoundSettingManager = GetComponent<SoundSettingManager>();
Instance.SoundSettingManager.ReloadReferences();
} }
#region Map Load Handling #region Map Load Handling
/// <summary> /// <summary>
/// Triggers transition to a map point /// Triggers transition to a map point
/// </summary> /// </summary>
public void GoToMapPoint(MapPoint mapPoint) public void GoToMapPoint(MapPoint mapPoint, bool instantBlackScreen = false)
{ {
StartCoroutine(GoToMapPointCoroutine(mapPoint)); StartCoroutine(GoToMapPointCoroutine(mapPoint, instantBlackScreen));
} }
/// <summary> /// <summary>
/// Executes transition to map point (scene and location) /// Executes transition to map point (scene and location)
/// </summary> /// </summary>
private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint) private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint, bool instantBlackScreen)
{ {
Instance.isTransitioningScenes = true; Instance.isTransitioningScenes = true;
Instance.PlayerController.SetCharacterControl(false); Instance.PlayerController.SetCharacterControl(false);
@@ -89,15 +92,24 @@ private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
float fadeTime = 0; float fadeTime = 0;
Color blackScreenColor = Color.black; Color blackScreenColor = Color.black;
while (fadeTime < fadeDuration) // Fade to black when instantBlackScreen is false
if (!instantBlackScreen)
{ {
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration); while (fadeTime < fadeDuration)
Instance.BlackScreen.color = blackScreenColor; {
fadeTime += Time.deltaTime; blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
yield return null; Instance.BlackScreen.color = blackScreenColor;
fadeTime += Time.deltaTime;
yield return null;
}
fadeTime = 0;
}
else
{
// instantly make screen black before scene transition
blackScreenColor.a = 1;
Instance.BlackScreen.color = blackScreenColor;
} }
fadeTime = 0;
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(mapPoint.Scene); AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(mapPoint.Scene);
while (!asyncLoad.isDone) while (!asyncLoad.isDone)
@@ -126,6 +138,9 @@ private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
yield return null; yield return null;
} }
blackScreenColor.a = 0;
Instance.BlackScreen.color = blackScreenColor;
// move character a little more // move character a little more
while (fadeTime < moveDuration) while (fadeTime < moveDuration)
{ {
@@ -183,6 +198,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
ReloadReferences(); ReloadReferences();
// Make sure screen is black in new scene // Make sure screen is black in new scene
blackScreenColor.a = 1;
Instance.BlackScreen.color = blackScreenColor; Instance.BlackScreen.color = blackScreenColor;
SceneDoor door = GameSceneManager.Instance.GetDoorWithId(doorId); SceneDoor door = GameSceneManager.Instance.GetDoorWithId(doorId);
@@ -207,6 +223,9 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
yield return null; yield return null;
} }
blackScreenColor.a = 0;
Instance.BlackScreen.color = blackScreenColor;
// move character a little more // move character a little more
while (fadeTime < moveDuration) while (fadeTime < moveDuration)
{ {
+6
View File
@@ -7,4 +7,10 @@ public class MapPoint
{ {
public string Scene; public string Scene;
public Vector3 SpawnPosition; public Vector3 SpawnPosition;
public MapPoint(string scene, Vector3 spawnPosition)
{
this.Scene = scene;
this.SpawnPosition = spawnPosition;
}
} }
+9 -7
View File
@@ -17,14 +17,16 @@ public void SavePlayerData(ref PlayerSaveData data)
public void LoadPlayerData(PlayerSaveData data) public void LoadPlayerData(PlayerSaveData data)
{ {
/*if (data.currentScene != null && data.currentScene != SceneManager.GetActiveScene().name) if (data.currentScene != null && data.currentScene != SceneManager.GetActiveScene().name)
{ {
SceneManager.LoadScene(data.currentScene); GameManager.Instance.GoToMapPoint(new MapPoint(data.currentScene, data.dougPosition), true);
}*/ }
else
GameManager.Instance.PlayerManager.CurrentToolIndex = data.activeToolIndex; {
GameManager.Instance.PlayerController.cameraController.SnapToRotation(data.camRotation); GameManager.Instance.PlayerManager.CurrentToolIndex = data.activeToolIndex;
GameManager.Instance.PlayerController.transform.position = data.dougPosition; GameManager.Instance.PlayerController.cameraController.SnapToRotation(data.camRotation);
GameManager.Instance.PlayerController.transform.position = data.dougPosition;
}
} }
#endregion #endregion
} }
@@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: -2 executionOrder: -501
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
+3
View File
@@ -14,6 +14,7 @@ public struct SaveData
public InventorySaveData InventorySaveData; public InventorySaveData InventorySaveData;
public TimeSaveData TimeSaveData; public TimeSaveData TimeSaveData;
public PlayerSaveData PlayerSaveData; public PlayerSaveData PlayerSaveData;
public SoundSettingSaveData SoundSettingSaveData;
} }
public static string SaveFileName() public static string SaveFileName()
@@ -61,6 +62,7 @@ private static void HandleSaveData()
GameManager.Instance.TimeManager.SaveTime(ref _saveData.TimeSaveData); GameManager.Instance.TimeManager.SaveTime(ref _saveData.TimeSaveData);
GameManager.Instance.PlayerManager.SavePlayerData(ref _saveData.PlayerSaveData); GameManager.Instance.PlayerManager.SavePlayerData(ref _saveData.PlayerSaveData);
QuestRegistry.Instance.SaveQuestData(ref _saveData.QuestData); QuestRegistry.Instance.SaveQuestData(ref _saveData.QuestData);
GameManager.Instance.SoundSettingManager.SaveSoundSettingsData(ref _saveData.SoundSettingSaveData);
} }
public static void Load() public static void Load()
@@ -101,5 +103,6 @@ public static void HandleLoadData()
GameManager.Instance.TimeManager.LoadTime(_saveData.TimeSaveData); GameManager.Instance.TimeManager.LoadTime(_saveData.TimeSaveData);
GameManager.Instance.PlayerManager.LoadPlayerData(_saveData.PlayerSaveData); GameManager.Instance.PlayerManager.LoadPlayerData(_saveData.PlayerSaveData);
QuestRegistry.Instance.LoadQuestData(_saveData.QuestData); QuestRegistry.Instance.LoadQuestData(_saveData.QuestData);
GameManager.Instance.SoundSettingManager.LoadSoundSettingsData(_saveData.SoundSettingSaveData);
} }
} }
+71
View File
@@ -0,0 +1,71 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class SoundSettingManager : MonoBehaviour
{
float masterVolume;
float musicVolume;
float sfxVolume;
Slider MasterSlider;
Slider SfxSlider;
Slider MusicSlider;
private void Start()
{
MasterSlider.value = masterVolume;
SfxSlider.value = sfxVolume;
MusicSlider.value = musicVolume;
}
public void ReloadReferences()
{
MasterSlider = GameObject.FindWithTag("MasterSlider").GetComponent<Slider>();
SfxSlider = GameObject.FindWithTag("SfxSlider").GetComponent<Slider>();
MusicSlider = GameObject.FindWithTag("MusicSlider").GetComponent<Slider>();
MasterSlider.onValueChanged.AddListener(OnMasterValueChanged);
SfxSlider.onValueChanged.AddListener(OnSfxValueChanged);
MusicSlider.onValueChanged.AddListener(OnMusicValueChanged);
}
public void OnMasterValueChanged(float newValue)
{
masterVolume = newValue;
}
public void OnSfxValueChanged(float newValue)
{
sfxVolume = newValue;
}
public void OnMusicValueChanged(float newValue)
{
musicVolume = newValue;
}
#region Sound Settings Data Save/Load
public void SaveSoundSettingsData(ref SoundSettingSaveData data)
{
data.musicVolume = musicVolume;
data.sfxVolume = sfxVolume;
data.masterVolume = masterVolume;
}
public void LoadSoundSettingsData(SoundSettingSaveData data)
{
musicVolume = data.musicVolume;
sfxVolume = data.sfxVolume;
masterVolume = data.masterVolume;
}
#endregion
}
[System.Serializable]
public struct SoundSettingSaveData
{
public float musicVolume;
public float sfxVolume;
public float masterVolume;
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ab14394efecbd6540af369ced75e81d0
+2134 -3
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -14,6 +14,9 @@ TagManager:
- ItemPickupText - ItemPickupText
- DialogContainer - DialogContainer
- PauseMenu - PauseMenu
- MasterSlider
- SfxSlider
- MusicSlider
layers: layers:
- Default - Default
- TransparentFX - TransparentFX