浏览代码

Better comments

/main
Unknown 4 年前
当前提交
87b7db67
共有 11 个文件被更改,包括 57 次插入12 次删除
  1. 7
      UOP1_Project/Assets/Scripts/Event Listeners/IntEventListener.cs
  2. 4
      UOP1_Project/Assets/Scripts/Event Listeners/VoidEventListener.cs
  3. 4
      UOP1_Project/Assets/Scripts/LevelEnd.cs
  4. 18
      UOP1_Project/Assets/Scripts/LocationLoader.cs
  5. 4
      UOP1_Project/Assets/Scripts/Scriptable Objects/Events/IntGameEvent.cs
  6. 10
      UOP1_Project/Assets/Scripts/Scriptable Objects/Events/LoadEvent.cs
  7. 4
      UOP1_Project/Assets/Scripts/Scriptable Objects/Events/VoidGameEvent.cs
  8. 4
      UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/GameScene.cs
  9. 5
      UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/Location.cs
  10. 5
      UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/Menu.cs
  11. 4
      UOP1_Project/Assets/Scripts/StartGame.cs

7
UOP1_Project/Assets/Scripts/Event Listeners/IntEventListener.cs


using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// To use a generic UnityEvent type you must override the class type
/// </summary>
/// <summary>
/// This class is listener for Int Events
/// </summary>
public class IntEventListener : MonoBehaviour
{
public IntGameEvent intGameEvent;

4
UOP1_Project/Assets/Scripts/Event Listeners/VoidEventListener.cs


using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// This class is listener for Void Events
/// </summary>
public class VoidEventListener : MonoBehaviour
{
public VoidGameEvent voidGameEvent;

4
UOP1_Project/Assets/Scripts/LevelEnd.cs


using UnityEngine;
/// <summary>
/// This class detecs when the level(Location) ends
/// </summary>
public class LevelEnd : MonoBehaviour
{
public LoadEvent onLevelEnd;

18
UOP1_Project/Assets/Scripts/LocationLoader.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.InputSystem;
/// <summary>
/// This class manages the scenes loading and unloading
/// </summary>
public class LocationLoader : MonoBehaviour
{

public Image loadingProgressBar;
[Header("Load Event")]
//Load Event we are listening to
//The load event we are listening to
[SerializeField] private LoadEvent _loadEvent = default;
//List of the scenes to load and track progress

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

}
}
}
public void UnloadScenes()
{
if(_ScenesToUnload != null)

_ScenesToUnload.Clear();
}
//Check if a scene is already loaded
/// <summary> This function checks if a scene is already loaded </summary>
public bool CheckLoadState(String sceneName)
{
if (SceneManager.sceneCount > 0)

return false;
}
//Update loading progress
/// <summary> This function update loading progress </summary>
IEnumerator LoadingScreen()
{
float totalProgress = 0;

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


using UnityEngine.Events;
using UnityEngine;
/// <summary>
/// This class is used for Events that have one Int argument (Example: Achievement Unlock Event)
/// </summary>
[CreateAssetMenu(fileName = "IntGameEvent", menuName = "Game Event/Int")]
public class IntGameEvent : ScriptableObject
{

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


using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// This class is a used for scene loading Events
/// Takes an array of the scenes we want to load
/// and a bool to specify if we want to show a loading screen
/// </summary>
public void RaiseEvent(GameScene[] locationsToLoad, bool loadScreen)
public void RaiseEvent(GameScene[] locationsToLoad, bool showLoadingScreen)
if (loadEvent != null) loadEvent.Invoke(locationsToLoad, loadScreen);
if (loadEvent != null) loadEvent.Invoke(locationsToLoad, showLoadingScreen);
}
}

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


using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// This class is used for Events that have no arguments (Example: Exit game event)
/// </summary>
[CreateAssetMenu(fileName = "VoidGameEvent", menuName = "Game Event/Void")]
public class VoidGameEvent : ScriptableObject
{

4
UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/GameScene.cs


using UnityEngine;
/// <summary>
/// This class is a base class which contains what is commun for all game scenes (Locations or Menus)
/// </summary>
public class GameScene : ScriptableObject
{
[Header("Information")]

5
UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/Location.cs


using UnityEngine;
/// <summary>
/// This class contains Settings specific to Locations only
/// </summary>
//Settings specific to level only
[Header("Location specific")]
public int enemiesCount;
}

5
UOP1_Project/Assets/Scripts/Scriptable Objects/SceneManagement/Menu.cs


using UnityEngine;
/// <summary>
/// This class contains Settings specific to Menus only
/// </summary>
public enum Type
{
Main_Menu,

[CreateAssetMenu(fileName = "NewMenu", menuName = "Scene Data/Menu")]
public class Menu : GameScene
{
//Settings specific to menu only
[Header("Menu specific")]
public Type type;
}

4
UOP1_Project/Assets/Scripts/StartGame.cs


using UnityEngine;
/// <summary>
/// This class contains the function to call when play button is pressed
/// </summary>
public class StartGame : MonoBehaviour
{
public LoadEvent onPlayButtonPress;

正在加载...
取消
保存