浏览代码

Using bool instead of event because on the same GO

/main
Amel Negra 4 年前
当前提交
a6b2a938
共有 9 个文件被更改,包括 10 次插入57 次删除
  1. 5
      UOP1_Project/Assets/Prefabs/GameplayEssentials/LocationEditorInitializer.prefab
  2. 3
      UOP1_Project/Assets/Prefabs/GameplayEssentials/MenuEditorInitializer.prefab
  3. 23
      UOP1_Project/Assets/SceneReadyBroadcaster.cs
  4. 9
      UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs
  5. 1
      UOP1_Project/Assets/Scripts/SceneManagement/LoadingScreenManager.cs
  6. 1
      UOP1_Project/Assets/Scripts/SceneManagement/SceneLoader.cs
  7. 1
      UOP1_Project/Assets/Scripts/SpawnSystem.cs
  8. 16
      UOP1_Project/Assets/ScriptableObjects/EventChannels/OnEditorInitializer.asset
  9. 8
      UOP1_Project/Assets/ScriptableObjects/EventChannels/OnEditorInitializer.asset.meta

5
UOP1_Project/Assets/Prefabs/GameplayEssentials/LocationEditorInitializer.prefab


m_Script: {fileID: 11500000, guid: afdc0d26809578642bceb401301d2a8a, type: 3}
m_Name:
m_EditorClassIdentifier:
persistentScenes:
scenesToLoad:
_isEditorInitializerMode: 0
_OnEditorInitializer: {fileID: 11400000, guid: 13c350be03ed8f54cbc7630aa33b3d7b,
type: 2}
--- !u!114 &7222522106795826365

m_Script: {fileID: 11500000, guid: ca77942077a1ca846af4cc29b07958a8, type: 3}
m_Name:
m_EditorClassIdentifier:
_OnEditorInitializer: {fileID: 11400000, guid: 13c350be03ed8f54cbc7630aa33b3d7b,
type: 2}
_OnSceneReady: {fileID: 11400000, guid: b729e40fc41dd8b4ea7aaf5c857f7186, type: 2}

3
UOP1_Project/Assets/Prefabs/GameplayEssentials/MenuEditorInitializer.prefab


m_Script: {fileID: 11500000, guid: afdc0d26809578642bceb401301d2a8a, type: 3}
m_Name:
m_EditorClassIdentifier:
persistentScenes:
scenesToLoad:
_isEditorInitializerMode: 0
_OnEditorInitializer: {fileID: 11400000, guid: 13c350be03ed8f54cbc7630aa33b3d7b,
type: 2}

23
UOP1_Project/Assets/SceneReadyBroadcaster.cs


public class SceneReadyBroadcaster : MonoBehaviour
{
#if UNITY_EDITOR
[Header("On Editor Initializer event")]
[SerializeField] private VoidEventChannelSO _OnEditorInitializer = default;
private void OnEnable()
private void Start()
if (_OnEditorInitializer != null)
if(GetComponent<EditorInitialisationLoader>()._isEditorInitializerMode == true)
_OnEditorInitializer.OnEventRaised += InformSceneIsReady;
_OnSceneReady.RaiseEvent();
private void OnDisable()
{
if (_OnEditorInitializer != null)
{
_OnEditorInitializer.OnEventRaised -= InformSceneIsReady;
}
}
void InformSceneIsReady()
{
_OnSceneReady.RaiseEvent();
}
#endif
}

9
UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs


#if UNITY_EDITOR
public GameSceneSO[] scenesToLoad;
public int targetFramerate = 0; // For debugging purposes
//add bool and access it from other script
[Header("Broadcasting on")]
[SerializeField] private VoidEventChannelSO _OnEditorInitializer = default;
//bool to know if we are coming from editor initializer mode
[HideInInspector] public bool _isEditorInitializerMode=false;
private void Start()
{

{
SceneManager.LoadSceneAsync(scenesToLoad[j].scenePath, LoadSceneMode.Additive);
//Inform that we are pressing play from a location or menu
_OnEditorInitializer.RaiseEvent();
_isEditorInitializerMode = true;
}
}
}

1
UOP1_Project/Assets/Scripts/SceneManagement/LoadingScreenManager.cs


private void ToggleLoadingScreen(bool state)
{
Debug.Log("I am toggeling the loading screen");
loadingInterface.SetActive(state);
}

1
UOP1_Project/Assets/Scripts/SceneManagement/SceneLoader.cs


{
//Take the first scene in the array as the scene we want to set active
_activeScene = locationsToLoad[0];
Debug.Log("active scene = " + _activeScene.scenePath);
UnloadScenes();
if (showLoadingScreen)

1
UOP1_Project/Assets/Scripts/SpawnSystem.cs


using System;
using System.Linq;
using UnityEngine;
using UnityEngine.Serialization;
public class SpawnSystem : MonoBehaviour
{

16
UOP1_Project/Assets/ScriptableObjects/EventChannels/OnEditorInitializer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7fafac715ff920c4383fed91a38a351e, type: 3}
m_Name: OnEditorInitializer
m_EditorClassIdentifier:
description: Raised when user presses play from any scene, used to raise the OnSceneReady
event

8
UOP1_Project/Assets/ScriptableObjects/EventChannels/OnEditorInitializer.asset.meta


fileFormatVersion: 2
guid: 13c350be03ed8f54cbc7630aa33b3d7b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存