浏览代码

SO name updated in other scripts

/main
Unknown 4 年前
当前提交
a5ff75ad
共有 6 个文件被更改,包括 30 次插入35 次删除
  1. 6
      UOP1_Project/Assets/Scripts/Editor/GameSceneEditor.cs
  2. 2
      UOP1_Project/Assets/Scripts/SceneManagement/LevelEnd.cs
  3. 14
      UOP1_Project/Assets/Scripts/SceneManagement/LoadSceneLoader.cs
  4. 37
      UOP1_Project/Assets/Scripts/SceneManagement/LocationLoader.cs
  5. 2
      UOP1_Project/Assets/Scripts/SceneManagement/StartGame.cs
  6. 4
      UOP1_Project/Assets/Scripts/Scriptable Objects/Events/LoadEvent.cs

6
UOP1_Project/Assets/Scripts/Editor/GameSceneEditor.cs


using UnityEngine;
using UnityEngine.SceneManagement;
[CustomEditor(typeof(GameScene), true)]
[CustomEditor(typeof(GameSceneSO), true)]
public class GameSceneEditor : Editor
{
#region UI_Warnings

private static readonly string[] ExcludedProperties = { "m_Script", "sceneName" };
private string[] sceneList;
private GameScene gameSceneTarget;
private GameSceneSO gameSceneTarget;
gameSceneTarget = target as GameScene;
gameSceneTarget = target as GameSceneSO;
PopulateScenePicker();
InitializeGuiStyles();
}

2
UOP1_Project/Assets/Scripts/SceneManagement/LevelEnd.cs


public class LevelEnd : MonoBehaviour
{
public LoadEvent onLevelEnd;
public GameScene[] locationsToLoad;
public GameSceneSO[] locationsToLoad;
public bool showLoadScreen;
private void OnTriggerEnter(Collider other)
{

14
UOP1_Project/Assets/Scripts/SceneManagement/LoadSceneLoader.cs


public class LoadSceneLoader : MonoBehaviour
{
public GameSceneSO initializationScene;
if (SceneManager.sceneCount > 0)
for (int i = 0; i < SceneManager.sceneCount; ++i)
for (int i = 0; i < SceneManager.sceneCount; ++i)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name == initializationScene.sceneName)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name == "ScenesLoader")
{
return;
}
return;
SceneManager.LoadSceneAsync("ScenesLoader", LoadSceneMode.Additive);
SceneManager.LoadSceneAsync(initializationScene.sceneName, LoadSceneMode.Additive);
#endif
}
}

37
UOP1_Project/Assets/Scripts/SceneManagement/LocationLoader.cs


public class LocationLoader : MonoBehaviour
{
public GameScene[] mainMenuScenes;
[Header("Initialization Scene")]
public GameSceneSO initializationScene;
[Header("Load on start")]
public GameSceneSO[] mainMenuScenes;
[Header("Loading Screen")]
public GameObject loadingInterface;
public Image loadingProgressBar;

//List of scenes to unload
private List<Scene> _ScenesToUnload = new List<Scene>();
//Keep track of the scene we want to set as active (for lighting/skybox)
private GameScene _activeScene;
private GameSceneSO _activeScene;
private void OnEnable()
{

private void Start()
{
if(SceneManager.GetActiveScene().name == "ScenesLoader")
if(SceneManager.GetActiveScene().name == initializationScene.sceneName)
{
LoadMainMenu();
}

}
/// <summary> This function loads the scenes passed as array parameter </summary>
public void LoadScenes(GameScene[] locationsToLoad, bool showLoadingScreen)
public void LoadScenes(GameSceneSO[] locationsToLoad, bool showLoadingScreen)
{
//Add all current open scenes to unload list
AddScenesToUnload();

}
public void AddScenesToUnload()
{
if (SceneManager.sceneCount > 0)
for (int i = 0; i < SceneManager.sceneCount; ++i)
for (int i = 0; i < SceneManager.sceneCount; ++i)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name != initializationScene.sceneName)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name != "ScenesLoader")
{
Debug.Log("Added scene to unload = " + scene.name);
//Add the scene to the list of the scenes to unload
_ScenesToUnload.Add(scene);
}
Debug.Log("Added scene to unload = " + scene.name);
//Add the scene to the list of the scenes to unload
_ScenesToUnload.Add(scene);
}
}
}

public bool CheckLoadState(String sceneName)
{
if (SceneManager.sceneCount > 0)
for (int i = 0; i < SceneManager.sceneCount; ++i)
for (int i = 0; i < SceneManager.sceneCount; ++i)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name == sceneName)
Scene scene = SceneManager.GetSceneAt(i);
if (scene.name == sceneName)
{
return true;
}
return true;
}
}
return false;

2
UOP1_Project/Assets/Scripts/SceneManagement/StartGame.cs


public class StartGame : MonoBehaviour
{
public LoadEvent onPlayButtonPress;
public GameScene[] locationsToLoad;
public GameSceneSO[] locationsToLoad;
public bool showLoadScreen;
public void OnPlayButtonPress()

4
UOP1_Project/Assets/Scripts/Scriptable Objects/Events/LoadEvent.cs


[CreateAssetMenu(fileName = "LoadGameEvent", menuName = "Game Event/Load")]
public class LoadEvent : ScriptableObject
{
public UnityAction<GameScene[], bool> loadEvent;
public void Raise(GameScene[] locationsToLoad, bool showLoadingScreen)
public UnityAction<GameSceneSO[], bool> loadEvent;
public void Raise(GameSceneSO[] locationsToLoad, bool showLoadingScreen)
{
if (loadEvent != null)
loadEvent.Invoke(locationsToLoad, showLoadingScreen);
正在加载...
取消
保存