Compare commits
2 Commits
db47bc3768
...
9ba1ff4a1f
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ba1ff4a1f | |||
| 8dd61407cd |
@@ -438,6 +438,7 @@ GameObject:
|
||||
- component: {fileID: 7681847596368765025}
|
||||
- component: {fileID: 4444498079052879519}
|
||||
- component: {fileID: 5173819118098093347}
|
||||
- component: {fileID: 1410439939888368689}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
@@ -560,3 +561,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerManager
|
||||
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
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
public Button SettingsButton;
|
||||
public Button SaveButton;
|
||||
public Button DeleteSaveButton;
|
||||
public Button QuitButton;
|
||||
|
||||
public GameObject SettingsMenu;
|
||||
|
||||
public void ReloadReferences()
|
||||
{
|
||||
// pull all game objs here
|
||||
@@ -14,6 +17,7 @@ public void ReloadReferences()
|
||||
|
||||
void Start()
|
||||
{
|
||||
SettingsButton.onClick.AddListener(ShowSettings);
|
||||
SaveButton.onClick.AddListener(SaveSystem.Save);
|
||||
DeleteSaveButton.onClick.AddListener(SaveSystem.ClearSave);
|
||||
}
|
||||
@@ -22,4 +26,9 @@ void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ShowSettings()
|
||||
{
|
||||
SettingsMenu.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2984,17 +2984,6 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1286273673}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3149,17 +3138,6 @@ Transform:
|
||||
- {fileID: 813193272}
|
||||
m_Father: {fileID: 265036979}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3860,6 +3838,17 @@ Transform:
|
||||
- {fileID: 2146681817}
|
||||
m_Father: {fileID: 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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4156,17 +4145,6 @@ Transform:
|
||||
- {fileID: 441147620}
|
||||
m_Father: {fileID: 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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4408,10 +4386,46 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 1704696510}
|
||||
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}
|
||||
propertyPath: m_Name
|
||||
value: UI
|
||||
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}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
@@ -4452,18 +4466,18 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 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}
|
||||
propertyPath: QuitButton
|
||||
propertyPath: SettingsMenu
|
||||
value:
|
||||
objectReference: {fileID: 2079108456}
|
||||
objectReference: {fileID: 6325623361260993109}
|
||||
- target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
|
||||
propertyPath: SaveButton
|
||||
propertyPath: SettingsButton
|
||||
value:
|
||||
objectReference: {fileID: 1366274845}
|
||||
- target: {fileID: 8504793874200787636, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
|
||||
propertyPath: DeleteSaveButton
|
||||
value:
|
||||
objectReference: {fileID: 1299342542}
|
||||
objectReference: {fileID: 1889534305}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -4474,6 +4488,11 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 6792308726050395253, guid: 6d1ef2b53d3ef0446852da522af66b73, type: 3}
|
||||
m_PrefabInstance: {fileID: 6325623361260993107}
|
||||
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
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -15,6 +15,7 @@ public class GameManager : MonoBehaviour
|
||||
public Inventory Inventory { get; private set; }
|
||||
public Storybools Storybools { get; private set; }
|
||||
public PauseMenu PauseMenu { get; private set; }
|
||||
public SoundSettingManager SoundSettingManager { get; private set; }
|
||||
public PlayerController PlayerController { get; private set; }
|
||||
public Image BlackScreen { get; private set; }
|
||||
|
||||
@@ -44,7 +45,6 @@ private void Awake()
|
||||
private void Start()
|
||||
{
|
||||
SaveSystem.Load();
|
||||
SaveSystem.Save(); // save off any corruption fixes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,21 +64,24 @@ private void ReloadReferences()
|
||||
Instance.Inventory = GetComponent<Inventory>();
|
||||
Instance.TimeManager = GetComponent<TimeManager>();
|
||||
Instance.PlayerManager = GetComponent<PlayerManager>();
|
||||
|
||||
Instance.SoundSettingManager = GetComponent<SoundSettingManager>();
|
||||
Instance.SoundSettingManager.ReloadReferences();
|
||||
}
|
||||
|
||||
#region Map Load Handling
|
||||
/// <summary>
|
||||
/// Triggers transition to a map point
|
||||
/// </summary>
|
||||
public void GoToMapPoint(MapPoint mapPoint)
|
||||
public void GoToMapPoint(MapPoint mapPoint, bool instantBlackScreen = false)
|
||||
{
|
||||
StartCoroutine(GoToMapPointCoroutine(mapPoint));
|
||||
StartCoroutine(GoToMapPointCoroutine(mapPoint, instantBlackScreen));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes transition to map point (scene and location)
|
||||
/// </summary>
|
||||
private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
|
||||
private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint, bool instantBlackScreen)
|
||||
{
|
||||
Instance.isTransitioningScenes = true;
|
||||
Instance.PlayerController.SetCharacterControl(false);
|
||||
@@ -89,15 +92,24 @@ private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
|
||||
float fadeTime = 0;
|
||||
Color blackScreenColor = Color.black;
|
||||
|
||||
while (fadeTime < fadeDuration)
|
||||
// Fade to black when instantBlackScreen is false
|
||||
if (!instantBlackScreen)
|
||||
{
|
||||
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
|
||||
Instance.BlackScreen.color = blackScreenColor;
|
||||
fadeTime += Time.deltaTime;
|
||||
yield return null;
|
||||
while (fadeTime < fadeDuration)
|
||||
{
|
||||
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
|
||||
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);
|
||||
while (!asyncLoad.isDone)
|
||||
@@ -126,6 +138,9 @@ private IEnumerator GoToMapPointCoroutine(MapPoint mapPoint)
|
||||
yield return null;
|
||||
}
|
||||
|
||||
blackScreenColor.a = 0;
|
||||
Instance.BlackScreen.color = blackScreenColor;
|
||||
|
||||
// move character a little more
|
||||
while (fadeTime < moveDuration)
|
||||
{
|
||||
@@ -183,6 +198,7 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
||||
ReloadReferences();
|
||||
|
||||
// Make sure screen is black in new scene
|
||||
blackScreenColor.a = 1;
|
||||
Instance.BlackScreen.color = blackScreenColor;
|
||||
|
||||
SceneDoor door = GameSceneManager.Instance.GetDoorWithId(doorId);
|
||||
@@ -207,6 +223,9 @@ private IEnumerator EnterSceneDoorCoroutine(string scene, int doorId)
|
||||
yield return null;
|
||||
}
|
||||
|
||||
blackScreenColor.a = 0;
|
||||
Instance.BlackScreen.color = blackScreenColor;
|
||||
|
||||
// move character a little more
|
||||
while (fadeTime < moveDuration)
|
||||
{
|
||||
|
||||
@@ -7,4 +7,10 @@ public class MapPoint
|
||||
{
|
||||
public string Scene;
|
||||
public Vector3 SpawnPosition;
|
||||
|
||||
public MapPoint(string scene, Vector3 spawnPosition)
|
||||
{
|
||||
this.Scene = scene;
|
||||
this.SpawnPosition = spawnPosition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,16 @@ public void SavePlayerData(ref 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.PlayerManager.CurrentToolIndex = data.activeToolIndex;
|
||||
GameManager.Instance.PlayerController.cameraController.SnapToRotation(data.camRotation);
|
||||
GameManager.Instance.PlayerController.transform.position = data.dougPosition;
|
||||
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.PlayerController.transform.position = data.dougPosition;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -2
|
||||
executionOrder: -501
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
@@ -14,6 +14,7 @@ public struct SaveData
|
||||
public InventorySaveData InventorySaveData;
|
||||
public TimeSaveData TimeSaveData;
|
||||
public PlayerSaveData PlayerSaveData;
|
||||
public SoundSettingSaveData SoundSettingSaveData;
|
||||
}
|
||||
|
||||
public static string SaveFileName()
|
||||
@@ -61,6 +62,7 @@ private static void HandleSaveData()
|
||||
GameManager.Instance.TimeManager.SaveTime(ref _saveData.TimeSaveData);
|
||||
GameManager.Instance.PlayerManager.SavePlayerData(ref _saveData.PlayerSaveData);
|
||||
QuestRegistry.Instance.SaveQuestData(ref _saveData.QuestData);
|
||||
GameManager.Instance.SoundSettingManager.SaveSoundSettingsData(ref _saveData.SoundSettingSaveData);
|
||||
}
|
||||
|
||||
public static void Load()
|
||||
@@ -101,5 +103,6 @@ public static void HandleLoadData()
|
||||
GameManager.Instance.TimeManager.LoadTime(_saveData.TimeSaveData);
|
||||
GameManager.Instance.PlayerManager.LoadPlayerData(_saveData.PlayerSaveData);
|
||||
QuestRegistry.Instance.LoadQuestData(_saveData.QuestData);
|
||||
GameManager.Instance.SoundSettingManager.LoadSoundSettingsData(_saveData.SoundSettingSaveData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab14394efecbd6540af369ced75e81d0
|
||||
+2134
-3
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,9 @@ TagManager:
|
||||
- ItemPickupText
|
||||
- DialogContainer
|
||||
- PauseMenu
|
||||
- MasterSlider
|
||||
- SfxSlider
|
||||
- MusicSlider
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user