net.dreditor.roomloading 0.0.0-stage → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/CheckThreeDModeDuringLoad.cs +64 -0
- package/CheckThreeDModeDuringLoad.cs.meta +11 -0
- package/DRERoomTransition.cs +116 -0
- package/DRERoomTransition.cs.meta +11 -0
- package/DREStartAloneScene.cs +179 -0
- package/DREStartAloneScene.cs.meta +11 -0
- package/DREditor.RoomLoading.asmdef +24 -0
- package/DREditor.RoomLoading.asmdef.meta +7 -0
- package/DialogueRoomLoader.cs +188 -0
- package/DialogueRoomLoader.cs.meta +11 -0
- package/FadeOnEndTransitionFromSave.cs +205 -0
- package/FadeOnEndTransitionFromSave.cs.meta +11 -0
- package/FadeOutGeneratePastOnDebugTest.cs +97 -0
- package/FadeOutGeneratePastOnDebugTest.cs.meta +11 -0
- package/FadeOutOnRoomLoad.cs +75 -0
- package/FadeOutOnRoomLoad.cs.meta +11 -0
- package/FreezeColorRoomTransition.cs +186 -0
- package/FreezeColorRoomTransition.cs.meta +11 -0
- package/IPostTransitionRoutine.cs +17 -0
- package/IPostTransitionRoutine.cs.meta +11 -0
- package/IRoomLoadResolver.cs +15 -0
- package/IRoomLoadResolver.cs.meta +11 -0
- package/IRoomLoadRoutine.cs +17 -0
- package/IRoomLoadRoutine.cs.meta +11 -0
- package/IRoomTransition.cs +39 -0
- package/IRoomTransition.cs.meta +11 -0
- package/ITeleporter.cs +24 -0
- package/ITeleporter.cs.meta +11 -0
- package/InstanceManagerBase.cs +131 -0
- package/InstanceManagerBase.cs.meta +11 -0
- package/KeepStateAfterObjective.cs +74 -0
- package/KeepStateAfterObjective.cs.meta +11 -0
- package/MoveEndOnDialogueFinish.cs +131 -0
- package/MoveEndOnDialogueFinish.cs.meta +11 -0
- package/PastPointData.cs +44 -0
- package/PastPointData.cs.meta +11 -0
- package/PrepareTPFDOnLoadingRoom.cs +68 -0
- package/PrepareTPFDOnLoadingRoom.cs.meta +11 -0
- package/ResolveRoomLoadStates.cs +95 -0
- package/ResolveRoomLoadStates.cs.meta +11 -0
- package/RoomChanger.cs +265 -0
- package/RoomChanger.cs.meta +11 -0
- package/RoomChangerBase.cs +85 -0
- package/RoomChangerBase.cs.meta +11 -0
- package/RoomChangerLoader.cs +90 -0
- package/RoomChangerLoader.cs.meta +11 -0
- package/RoomLoadComponent.cs +13 -0
- package/RoomLoadComponent.cs.meta +11 -0
- package/RoomLoadFinisher.cs +81 -0
- package/RoomLoadFinisher.cs.meta +11 -0
- package/RoomLoadOptionsAsset.cs +45 -0
- package/RoomLoadOptionsAsset.cs.meta +11 -0
- package/RoomLoader.cs +265 -0
- package/RoomLoader.cs.meta +11 -0
- package/RoomLoaderBase.cs +87 -0
- package/RoomLoaderBase.cs.meta +11 -0
- package/RoomLoaderDebugger.cs +151 -0
- package/RoomLoaderDebugger.cs.meta +11 -0
- package/RoomLoaderHolder.cs +10 -0
- package/RoomLoaderHolder.cs.meta +11 -0
- package/Samples~/BlackTransitionOnlyOption.asset +18 -0
- package/Samples~/BlackTransitionOnlyOption.asset.meta +8 -0
- package/Samples~/BlackTransitionToInvestigationOption.asset +18 -0
- package/Samples~/BlackTransitionToInvestigationOption.asset.meta +8 -0
- package/Samples~/Check_ThreeD_Mode_During_Load.prefab +49 -0
- package/Samples~/Check_ThreeD_Mode_During_Load.prefab.meta +7 -0
- package/Samples~/DRE_Start_Alone_Scene.prefab +148 -0
- package/Samples~/DRE_Start_Alone_Scene.prefab.meta +7 -0
- package/Samples~/Dialogue_Room_Loader.prefab +55 -0
- package/Samples~/Dialogue_Room_Loader.prefab.meta +7 -0
- package/Samples~/FadeOutBlackTransitionOption.asset +18 -0
- package/Samples~/FadeOutBlackTransitionOption.asset.meta +8 -0
- package/Samples~/Fade_On_End_Transition_From_Save.prefab +145 -0
- package/Samples~/Fade_On_End_Transition_From_Save.prefab.meta +7 -0
- package/Samples~/Fade_Out_Generate_Past_On_Debug_Test.prefab +139 -0
- package/Samples~/Fade_Out_Generate_Past_On_Debug_Test.prefab.meta +7 -0
- package/Samples~/Fade_Out_On_Room_Load.prefab +137 -0
- package/Samples~/Fade_Out_On_Room_Load.prefab.meta +7 -0
- package/Samples~/Freeze_Transition_Canvas.prefab +300 -0
- package/Samples~/Freeze_Transition_Canvas.prefab.meta +7 -0
- package/Samples~/IsLoadingToRoom.asset +19 -0
- package/Samples~/IsLoadingToRoom.asset.meta +8 -0
- package/Samples~/Move_End_On_Dialogue_Finish.prefab +52 -0
- package/Samples~/Move_End_On_Dialogue_Finish.prefab.meta +7 -0
- package/Samples~/OnFadingOutOfLoading.asset +15 -0
- package/Samples~/OnFadingOutOfLoading.asset.meta +8 -0
- package/Samples~/OnFinishedLoadingRoom.asset +14 -0
- package/Samples~/OnFinishedLoadingRoom.asset.meta +8 -0
- package/Samples~/OnLoadingThreeDRoom.asset +14 -0
- package/Samples~/OnLoadingThreeDRoom.asset.meta +8 -0
- package/Samples~/OnLoadingThreeDRoomListener.prefab +51 -0
- package/Samples~/OnLoadingThreeDRoomListener.prefab.meta +7 -0
- package/Samples~/On_Finished_Loading_Room_Listener.prefab +51 -0
- package/Samples~/On_Finished_Loading_Room_Listener.prefab.meta +7 -0
- package/Samples~/On_Finished_Loading_Room_No_Dialogue_Listener.prefab +51 -0
- package/Samples~/On_Finished_Loading_Room_No_Dialogue_Listener.prefab.meta +7 -0
- package/Samples~/On_Finished_Room_Transitions_Listener.prefab +51 -0
- package/Samples~/On_Finished_Room_Transitions_Listener.prefab.meta +7 -0
- package/Samples~/On_Loading_Room_Listener.prefab +51 -0
- package/Samples~/On_Loading_Room_Listener.prefab.meta +7 -0
- package/Samples~/On_Started_Changing_Room_Listener.prefab +51 -0
- package/Samples~/On_Started_Changing_Room_Listener.prefab.meta +7 -0
- package/Samples~/Prepare_TPFD_On_Room_Loading.prefab +142 -0
- package/Samples~/Prepare_TPFD_On_Room_Loading.prefab.meta +7 -0
- package/Samples~/Resolve_Room_Load_States.prefab +54 -0
- package/Samples~/Resolve_Room_Load_States.prefab.meta +7 -0
- package/Samples~/Room_Changer.prefab +143 -0
- package/Samples~/Room_Changer.prefab.meta +7 -0
- package/Samples~/Room_Changer_Loader.prefab +53 -0
- package/Samples~/Room_Changer_Loader.prefab.meta +7 -0
- package/Samples~/Room_Instance_Manager.prefab +78 -0
- package/Samples~/Room_Instance_Manager.prefab.meta +7 -0
- package/Samples~/Room_Load_Finisher.prefab +139 -0
- package/Samples~/Room_Load_Finisher.prefab.meta +7 -0
- package/Samples~/Room_Loader.prefab +584 -0
- package/Samples~/Room_Loader.prefab.meta +7 -0
- package/Samples~/Room_Loader_Event_Listeners.prefab +337 -0
- package/Samples~/Room_Loader_Event_Listeners.prefab.meta +7 -0
- package/Samples~/Room_Loading_System_ETemplate.prefab +398 -0
- package/Samples~/Room_Loading_System_ETemplate.prefab.meta +7 -0
- package/Samples~/SkipActivateControls.asset +19 -0
- package/Samples~/SkipActivateControls.asset.meta +8 -0
- package/Samples~/Skip_Controls_When_Loaded.prefab +156 -0
- package/Samples~/Skip_Controls_When_Loaded.prefab.meta +7 -0
- package/Samples~/TPFD_Room_Loader.prefab +215 -0
- package/Samples~/TPFD_Room_Loader.prefab.meta +7 -0
- package/Samples~/TeleportTransitionOptions.asset +18 -0
- package/Samples~/TeleportTransitionOptions.asset.meta +8 -0
- package/Samples~/Teleport_Room_Manager.prefab +84 -0
- package/Samples~/Teleport_Room_Manager.prefab.meta +7 -0
- package/Samples~/UI_Visibility_On_Scene_Events.prefab +316 -0
- package/Samples~/UI_Visibility_On_Scene_Events.prefab.meta +7 -0
- package/SkipControlsWhenLoaded.cs +66 -0
- package/SkipControlsWhenLoaded.cs.meta +11 -0
- package/TPFDRoomAnimation.cs +84 -0
- package/TPFDRoomAnimation.cs.meta +11 -0
- package/TPFDRoomLoader.cs +93 -0
- package/TPFDRoomLoader.cs.meta +11 -0
- package/TeleportRoomManager.cs +114 -0
- package/TeleportRoomManager.cs.meta +11 -0
- package/package.json +43 -4
- package/package.json.meta +7 -0
- package/README.md +0 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.RoomLoading
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
[ClassHeader(nameof(RoomLoadComponent) + ", " + nameof(IRoomLoadResolver) +
|
|
11
|
+
"\n\n")]
|
|
12
|
+
public class ResolveRoomLoadStates : RoomLoadComponent, IRoomLoadResolver
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected BoolWithEvent inMenu = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected BoolWithEvent inTPFD = null;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected BoolWithEvent inLoading = null;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected BoolWithEvent inLeaveProcess = null;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected BoolWithEvent inThreeDMode = null;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected BoolWithEvent isLoadingToRoom = null;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Tooltip("")]
|
|
54
|
+
[SerializeField] protected SceneEvent onLoadingThreeDRoom = null;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/// <inheritdoc/>
|
|
58
|
+
public virtual void OnRoomLoadResolve() => ResolveStates();
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
protected virtual void ResolveStates()
|
|
64
|
+
{
|
|
65
|
+
InvokeActiveState();
|
|
66
|
+
|
|
67
|
+
DeactivateStates();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
///
|
|
72
|
+
/// </summary>
|
|
73
|
+
protected virtual void InvokeActiveState()
|
|
74
|
+
{
|
|
75
|
+
inTPFD.Invoke();
|
|
76
|
+
|
|
77
|
+
if (inThreeDMode.Value)
|
|
78
|
+
onLoadingThreeDRoom.Raise();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
///
|
|
83
|
+
/// </summary>
|
|
84
|
+
protected virtual void DeactivateStates()
|
|
85
|
+
{
|
|
86
|
+
isLoadingToRoom.SetValue(false);
|
|
87
|
+
|
|
88
|
+
inLoading.SetValue(false);
|
|
89
|
+
|
|
90
|
+
inLeaveProcess.SetValue(false);
|
|
91
|
+
|
|
92
|
+
inMenu.SetValue(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
package/RoomChanger.cs
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Fading;
|
|
4
|
+
using DREditor.Gates;
|
|
5
|
+
using DREditor.Progressing.Handling;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using System;
|
|
8
|
+
using System.Collections;
|
|
9
|
+
using UnityEngine;
|
|
10
|
+
using UnityEngine.EventSystems;
|
|
11
|
+
using UnityEngine.SceneManagement;
|
|
12
|
+
|
|
13
|
+
namespace DREditor.RoomLoading
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[ClassHeader(nameof(ServiceHolder<RoomChangerBase>) + " for type: " + nameof(RoomChangerBase) +
|
|
19
|
+
"\n\n")]
|
|
20
|
+
public class RoomChanger : RoomChangerBase
|
|
21
|
+
{
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Header("")]
|
|
26
|
+
[Divider]
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected BoolWithEvent inLoading = null;
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Tooltip("")]
|
|
34
|
+
[SerializeField] protected IntWithEvent currentState = null;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
[Tooltip("")]
|
|
40
|
+
[SerializeField] protected IntWithEvent currentChapterIndex = null;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
[Tooltip("")]
|
|
46
|
+
[SerializeField] protected BoolWithEvent objectiveKeepsInstanceData = null;
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
///
|
|
50
|
+
/// </summary>
|
|
51
|
+
[Tooltip("")]
|
|
52
|
+
[SerializeField] protected SceneEvent moveToNextNaturalObjective = null;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
[Tooltip("")]
|
|
58
|
+
[SerializeField] protected BoolWithEvent requiredFlagsTriggered = null;
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
[Tooltip("")]
|
|
64
|
+
[SerializeField] protected StringWithEvent currentObjectiveName = null;
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
///
|
|
68
|
+
/// </summary>
|
|
69
|
+
[Tooltip("")]
|
|
70
|
+
[SerializeField] protected TransformWithEvent playerSpawnPoint = null;
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
///
|
|
75
|
+
/// </summary>
|
|
76
|
+
[Header("")]
|
|
77
|
+
[Divider]
|
|
78
|
+
[Tooltip("")]
|
|
79
|
+
[SerializeField] protected float hideUIWaitTime = 0.5f;
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
///
|
|
83
|
+
/// </summary>
|
|
84
|
+
[Tooltip("")]
|
|
85
|
+
[SerializeField] protected float fadeToBlackOptionTime = 0.5f;
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
///
|
|
89
|
+
/// </summary>
|
|
90
|
+
[Tooltip("")]
|
|
91
|
+
[SerializeField] protected int investigationStateIndex = 2;
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
/// <inheritdoc/>
|
|
95
|
+
public override void ChangeRoom(Gate destination, ScriptableObject options = null)
|
|
96
|
+
=> StartCoroutine(ChangeRoomRoutine(destination, (RoomLoadOptionsAsset)options));
|
|
97
|
+
|
|
98
|
+
/// <summary>
|
|
99
|
+
///
|
|
100
|
+
/// </summary>
|
|
101
|
+
/// <param name="destination"></param>
|
|
102
|
+
/// <param name="options"></param>
|
|
103
|
+
protected virtual IEnumerator ChangeRoomRoutine(Gate destination, RoomLoadOptionsAsset options = null)
|
|
104
|
+
{
|
|
105
|
+
UnityEngine.Debug.Log($"REPORT: {ToString()}: Starting room change.");
|
|
106
|
+
|
|
107
|
+
this.options = options;
|
|
108
|
+
|
|
109
|
+
onStartedChangingRoom.Raise();
|
|
110
|
+
|
|
111
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
112
|
+
|
|
113
|
+
SetDestination(destination);
|
|
114
|
+
|
|
115
|
+
CheckChangeObjective();
|
|
116
|
+
|
|
117
|
+
yield return new WaitForSecondsRealtime(hideUIWaitTime);
|
|
118
|
+
|
|
119
|
+
inLoading.SetValue(true); // At this point the changing room process has started.
|
|
120
|
+
|
|
121
|
+
yield return EvaluateStartTransition();
|
|
122
|
+
|
|
123
|
+
AssignDestinationPosition();
|
|
124
|
+
|
|
125
|
+
yield return ChangeRoomScene();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// <summary>
|
|
129
|
+
///
|
|
130
|
+
/// </summary>
|
|
131
|
+
protected virtual void CheckChangeObjective()
|
|
132
|
+
{
|
|
133
|
+
Gate progressionGate = (Gate)ServiceLocator.GetService<ProgressionManagerBase>().currentObjective.ProgressionGate;
|
|
134
|
+
|
|
135
|
+
if (requiredFlagsTriggered.Value && (progressionGate == null || progressionGate == destination))
|
|
136
|
+
ChangeObjectiveCheckInstanceData();
|
|
137
|
+
else
|
|
138
|
+
SaveInstanceOfLeavingRoom();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// <summary>
|
|
142
|
+
///
|
|
143
|
+
/// </summary>
|
|
144
|
+
protected virtual void ChangeObjectiveCheckInstanceData()
|
|
145
|
+
{
|
|
146
|
+
UnityEngine.Debug.Log($"REPORT: {ToString()}: Game has recognized to change the objective.");
|
|
147
|
+
|
|
148
|
+
if (!objectiveKeepsInstanceData.Value)
|
|
149
|
+
ServiceLocator.GetService<InstanceManagerBase>().ClearRoomData();
|
|
150
|
+
else
|
|
151
|
+
SaveInstanceOfLeavingRoom();
|
|
152
|
+
|
|
153
|
+
moveToNextNaturalObjective.Raise();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// <summary>
|
|
157
|
+
///
|
|
158
|
+
/// </summary>
|
|
159
|
+
protected virtual void SaveInstanceOfLeavingRoom()
|
|
160
|
+
{
|
|
161
|
+
try
|
|
162
|
+
{
|
|
163
|
+
if (ServiceLocator.HasService<InstanceManagerBase>())
|
|
164
|
+
ServiceLocator.GetService<InstanceManagerBase>().SaveRoomInstance(SceneManager.GetActiveScene().name);
|
|
165
|
+
else
|
|
166
|
+
UnityEngine.Debug.LogWarning($"ALERT: {ToString()}: There is no RoomInstanceManager in the scene.");
|
|
167
|
+
}
|
|
168
|
+
catch (Exception exception)
|
|
169
|
+
{
|
|
170
|
+
UnityEngine.Debug.LogWarning($"ALERT: {ToString()}: The Room could not be saved because an error occurred" +
|
|
171
|
+
$" saving the room instance.");
|
|
172
|
+
|
|
173
|
+
UnityEngine.Debug.LogWarning(exception);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/// <summary>
|
|
178
|
+
///
|
|
179
|
+
/// </summary>
|
|
180
|
+
protected virtual IEnumerator EvaluateStartTransition()
|
|
181
|
+
{
|
|
182
|
+
bool abscentOptionsOrBlackTransition = options == null || !options.blackTransition;
|
|
183
|
+
|
|
184
|
+
if (abscentOptionsOrBlackTransition)
|
|
185
|
+
yield return ServiceLocator.GetService<IRoomTransition>().StartTransitionRoutine();
|
|
186
|
+
else if (options != null && options.blackTransition)
|
|
187
|
+
yield return ServiceLocator.GetService<GlobalFade>().FadeToRoutine(fadeToBlackOptionTime);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/// <summary>
|
|
191
|
+
///
|
|
192
|
+
/// </summary>
|
|
193
|
+
public override void AssignDestinationPosition()
|
|
194
|
+
{
|
|
195
|
+
if (options != null && options.toWaypoint > -1 && options.toWaypoint < destination.fastTravelMarkers.Count)
|
|
196
|
+
SetSpawnAtWaypoint();
|
|
197
|
+
else
|
|
198
|
+
SetSpawnAtFromGate();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// <summary>
|
|
202
|
+
///
|
|
203
|
+
/// </summary>
|
|
204
|
+
protected virtual void SetSpawnAtWaypoint()
|
|
205
|
+
{
|
|
206
|
+
Waypoint waypoint = destination.fastTravelMarkers[options.toWaypoint];
|
|
207
|
+
|
|
208
|
+
SetSpawnPositionAndRotation(waypoint.position, waypoint.rotation);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/// <summary>
|
|
212
|
+
///
|
|
213
|
+
/// </summary>
|
|
214
|
+
protected virtual void SetSpawnAtFromGate()
|
|
215
|
+
{
|
|
216
|
+
GateFrom fromG = destination.GetFromLocation(SceneManager.GetActiveScene().name);
|
|
217
|
+
|
|
218
|
+
if (fromG != null)
|
|
219
|
+
SetSpawnPositionAndRotation(fromG.position, fromG.rotation);
|
|
220
|
+
else
|
|
221
|
+
SetSpawnPositionAndRotation(Vector3.zero, Vector3.zero);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/// <summary>
|
|
225
|
+
///
|
|
226
|
+
/// </summary>
|
|
227
|
+
/// <param name="position"></param>
|
|
228
|
+
/// <param name="rotation"></param>
|
|
229
|
+
protected virtual void SetSpawnPositionAndRotation(Vector3 position, Vector3 rotation)
|
|
230
|
+
=> playerSpawnPoint.SetValue(new(position, Quaternion.Euler(rotation)));
|
|
231
|
+
|
|
232
|
+
/// <summary>
|
|
233
|
+
///
|
|
234
|
+
/// </summary>
|
|
235
|
+
protected virtual IEnumerator ChangeRoomScene()
|
|
236
|
+
{
|
|
237
|
+
string destinationSceneName = EvaluateDestinationScene();
|
|
238
|
+
|
|
239
|
+
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(destinationSceneName);
|
|
240
|
+
|
|
241
|
+
UnityEngine.Debug.Log($"REPORT: {ToString()}: CHANGING SCENE TO: " + destinationSceneName);
|
|
242
|
+
|
|
243
|
+
while (!asyncOperation.isDone)
|
|
244
|
+
{
|
|
245
|
+
UnityEngine.Debug.Log($"REPORT: {ToString()}: Load progress: " + asyncOperation.progress);
|
|
246
|
+
|
|
247
|
+
yield return null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/// <summary>
|
|
252
|
+
///
|
|
253
|
+
/// </summary>
|
|
254
|
+
/// <returns></returns>
|
|
255
|
+
protected virtual string EvaluateDestinationScene()
|
|
256
|
+
{
|
|
257
|
+
if ((options != null && options.toInvestigation) || currentState.Value == investigationStateIndex)
|
|
258
|
+
return destination.GetInvestigationRoom(currentChapterIndex.Value);
|
|
259
|
+
else if (destination.GetVariantScene(currentChapterIndex.Value, currentObjectiveName.Value) is string validScene)
|
|
260
|
+
return validScene;
|
|
261
|
+
else
|
|
262
|
+
return destination.ToAreaName;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Gates;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.RoomLoading
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
public abstract class RoomChangerBase : ServiceHolder<RoomChangerBase>, ISceneEventListener, IToTitleScreen
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected SceneEvent onStartedChangingRoom = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected SceneEvent startedNewGame = null;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
protected RoomLoadOptionsAsset options;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
protected Gate destination = null;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
protected virtual void OnEnable() => startedNewGame.RegisterListener(this);
|
|
39
|
+
|
|
40
|
+
protected virtual void OnDisable() => startedNewGame.UnregisterListener(this);
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
/// <param name="loadRoomOptions"></param>
|
|
46
|
+
public virtual void SetOptions(ScriptableObject loadRoomOptions) => options = (RoomLoadOptionsAsset)loadRoomOptions;
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
///
|
|
50
|
+
/// </summary>
|
|
51
|
+
/// <returns></returns>
|
|
52
|
+
public virtual RoomLoadOptionsAsset GetOptions() => options;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
/// <param name="destination"></param>
|
|
58
|
+
public virtual void SetDestination(Gate destination) => this.destination = destination;
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
/// <returns></returns>
|
|
64
|
+
public virtual Gate GetDestination() => destination;
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
///
|
|
68
|
+
/// </summary>
|
|
69
|
+
/// <param name="destination"></param>
|
|
70
|
+
/// <param name="options"></param>
|
|
71
|
+
public abstract void ChangeRoom(Gate destination, ScriptableObject options = null);
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
///
|
|
75
|
+
/// </summary>
|
|
76
|
+
public abstract void AssignDestinationPosition();
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/// <inheritdoc/>
|
|
80
|
+
public virtual void OnEventRaised() => SetDestination(null);
|
|
81
|
+
|
|
82
|
+
/// <inheritdoc/>
|
|
83
|
+
public virtual void ToTitleScreen() => SetOptions(null);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Cameras;
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.Gates;
|
|
5
|
+
using DREditor.Saving;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.RoomLoading
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[ClassHeader(nameof(IDRELoadableManager) +
|
|
16
|
+
"\n\n")]
|
|
17
|
+
public class RoomChangerLoader : MonoBehaviour, IDRESaveable, IDRELoadableManager
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Tooltip("")]
|
|
23
|
+
[SerializeField] protected GateDatabase gateDatabase = null;
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
[Tooltip("")]
|
|
29
|
+
[SerializeField] protected TransformWithEvent playerSpawnPoint = null;
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
[Tooltip("")]
|
|
35
|
+
[SerializeField] protected TransformWithEvent mouseAbs = null;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
[Header("")]
|
|
42
|
+
[Divider]
|
|
43
|
+
[Tooltip("")]
|
|
44
|
+
[SerializeField] protected string positionSaveKey = "Position";
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
[Tooltip("")]
|
|
50
|
+
[SerializeField] protected string rotationSaveKey = "Rotation";
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
[Tooltip("")]
|
|
56
|
+
[SerializeField] protected string mouseabsSaveKey = "MouseAbs";
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
///
|
|
60
|
+
/// </summary>
|
|
61
|
+
[Tooltip("")]
|
|
62
|
+
[SerializeField] protected string sceneNameSaveKey = "SceneName";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/// <inheritdoc/>
|
|
66
|
+
public virtual void LoadManager(Dictionary<string, object> saveDatas, bool inChapterSelect)
|
|
67
|
+
{
|
|
68
|
+
var position = saveDatas.Get<Vector3>(positionSaveKey);
|
|
69
|
+
|
|
70
|
+
var rotation = Quaternion.Euler(saveDatas.Get<Vector3>(rotationSaveKey));
|
|
71
|
+
|
|
72
|
+
PosRot spawnPointData = new(position, rotation);
|
|
73
|
+
|
|
74
|
+
playerSpawnPoint.SetValue(spawnPointData);
|
|
75
|
+
|
|
76
|
+
mouseAbs.SetValue(new(saveDatas.Get<Vector2>(mouseabsSaveKey), Quaternion.Euler(Vector3.zero)));
|
|
77
|
+
|
|
78
|
+
ServiceLocator.GetService<RoomChangerBase>().SetDestination(gateDatabase.GetArea(saveDatas.Get<string>(sceneNameSaveKey)));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// <inheritdoc/>
|
|
82
|
+
public virtual void Save(Dictionary<string, object> saveDatas)
|
|
83
|
+
{
|
|
84
|
+
var smoothMouse = FindAnyObjectByType<SmoothMouseLook>();
|
|
85
|
+
|
|
86
|
+
if (smoothMouse != null)
|
|
87
|
+
saveDatas.Set(mouseabsSaveKey, smoothMouse.GetAbsolute());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.RoomLoading
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
/// <remarks>
|
|
10
|
+
///
|
|
11
|
+
/// </remarks>
|
|
12
|
+
public abstract class RoomLoadComponent : MonoBehaviour { }
|
|
13
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Fading;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.RoomLoading
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader("")]
|
|
13
|
+
public class RoomLoadFinisher : MonoBehaviour
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected BoolWithEvent hasMenuAccess = null;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected BoolWithEvent inTrialMode = null;
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected BoolWithEvent inDialogue = null;
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
///
|
|
35
|
+
/// </summary>
|
|
36
|
+
[Tooltip("")]
|
|
37
|
+
[SerializeField] protected SceneEventListener onFinishedLoadingRoom = null;
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
[Tooltip("")]
|
|
43
|
+
[SerializeField] protected float fadeOutOnLoadRoomOptionTime = 1f;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
protected virtual void OnEnable() => onFinishedLoadingRoom.Response.AddListener(Finish);
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
protected virtual void OnDisable() => onFinishedLoadingRoom.Response.RemoveListener(Finish);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
public virtual void Finish()
|
|
61
|
+
{
|
|
62
|
+
ServiceLocator.GetService<RoomChangerBase>().SetDestination(null);
|
|
63
|
+
|
|
64
|
+
CheckFadeOutOption();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
///
|
|
69
|
+
/// </summary>
|
|
70
|
+
protected virtual void CheckFadeOutOption()
|
|
71
|
+
{
|
|
72
|
+
var options = ServiceLocator.GetService<RoomChangerBase>().GetOptions();
|
|
73
|
+
|
|
74
|
+
if (options != null && options.blackTransition && options.fadeOutOnLoad)
|
|
75
|
+
ServiceLocator.GetService<GlobalFade>().FadeOut(fadeOutOnLoadRoomOptionTime);
|
|
76
|
+
|
|
77
|
+
if (!inDialogue.Value && !inTrialMode.Value)
|
|
78
|
+
hasMenuAccess.SetValue(true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|