net.dreditor.eventobjectservices 0.1.4 → 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/BoolWithEventOnTitleScreen.cs +10 -0
- package/BoolWithEventOnTitleScreen.cs.meta +11 -0
- package/DREditor.EventObjectServices.asmdef +17 -0
- package/DREditor.EventObjectServices.asmdef.meta +7 -0
- package/EvaluateCamerasStates.cs +103 -0
- package/EvaluateCamerasStates.cs.meta +11 -0
- package/FloatWithEventListener.cs +10 -0
- package/FloatWithEventListener.cs.meta +11 -0
- package/FloatWithEventOnTitleScreen.cs +10 -0
- package/FloatWithEventOnTitleScreen.cs.meta +11 -0
- package/IntWithEventIndexListener.cs +25 -0
- package/IntWithEventIndexListener.cs.meta +11 -0
- package/IntWithEventListener.cs +10 -0
- package/IntWithEventListener.cs.meta +11 -0
- package/IntWithEventOnTitleScreen.cs +10 -0
- package/IntWithEventOnTitleScreen.cs.meta +11 -0
- package/InverseObjectStateBoolWithEvent.cs +50 -0
- package/InverseObjectStateBoolWithEvent.cs.meta +11 -0
- package/ObjectActiveOnChapterIndex.cs +84 -0
- package/ObjectActiveOnChapterIndex.cs.meta +11 -0
- package/ObjectNameDisplayer.cs +47 -0
- package/ObjectNameDisplayer.cs.meta +11 -0
- package/OptionWithEventListener.cs +57 -0
- package/OptionWithEventListener.cs.meta +11 -0
- package/ResetCharacterControllerOnEvent.cs +47 -0
- package/ResetCharacterControllerOnEvent.cs.meta +11 -0
- package/Samples~/Float_With_Event_On_Title_Screen.prefab +48 -0
- package/{package.json.meta → Samples~/Float_With_Event_On_Title_Screen.prefab.meta} +2 -2
- package/Samples~/Int_With_Event_On_Title_Screen.prefab +48 -0
- package/Samples~/Int_With_Event_On_Title_Screen.prefab.meta +7 -0
- package/Samples~/Reset_Player.prefab +118 -0
- package/Samples~/Reset_Player.prefab.meta +7 -0
- package/Samples~/Selectable_Object_Manager.prefab +49 -0
- package/Samples~/Selectable_Object_Manager.prefab.meta +7 -0
- package/SceneEventOnStart.cs +27 -0
- package/SceneEventOnStart.cs.meta +11 -0
- package/SelectStringWithEvent.cs +44 -0
- package/SelectStringWithEvent.cs.meta +11 -0
- package/SelectableObjectManager.cs +45 -0
- package/SelectableObjectManager.cs.meta +11 -0
- package/SpriteOnIntEvent.cs +68 -0
- package/SpriteOnIntEvent.cs.meta +11 -0
- package/StringWithEventListener.cs +10 -0
- package/StringWithEventListener.cs.meta +11 -0
- package/TextWithEventListener.cs +46 -0
- package/TextWithEventListener.cs.meta +11 -0
- package/ValueWithEventListener.cs +60 -0
- package/ValueWithEventListener.cs.meta +11 -0
- package/ValueWithEventOnTitleScreen.cs +37 -0
- package/ValueWithEventOnTitleScreen.cs.meta +11 -0
- package/package.json +15 -3
package/.attestation.p7m
CHANGED
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class BoolWithEventOnTitleScreen : ValueWithEventOnTitleScreen<bool, BoolEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.EventObjectServices",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"DREditor",
|
|
6
|
+
"Unity.TextMeshPro"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [],
|
|
9
|
+
"excludePlatforms": [],
|
|
10
|
+
"allowUnsafeCode": false,
|
|
11
|
+
"overrideReferences": false,
|
|
12
|
+
"precompiledReferences": [],
|
|
13
|
+
"autoReferenced": true,
|
|
14
|
+
"defineConstraints": [],
|
|
15
|
+
"versionDefines": [],
|
|
16
|
+
"noEngineReferences": false
|
|
17
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.EventObjectServices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader("")]
|
|
12
|
+
public class EvaluateCamerasStates : MonoBehaviour
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected BoolWithEvent inTrialMode = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected BoolWithEvent inCGMode = null;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected BoolWithEvent inVideoMode = null;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected List<BoolWithEvent> cameras = new();
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
protected virtual void Start() => StartListeningToEvents();
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
protected virtual void StartListeningToEvents()
|
|
48
|
+
{
|
|
49
|
+
inTrialMode.AddListener(EvaluateInTrialState);
|
|
50
|
+
|
|
51
|
+
inCGMode.AddListener(EvaluateInCGState);
|
|
52
|
+
|
|
53
|
+
inVideoMode.AddListener(EvaluateInCGState);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
protected virtual void OnDisable() => StopListeningToEvents();
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
///
|
|
63
|
+
/// </summary>
|
|
64
|
+
protected virtual void StopListeningToEvents()
|
|
65
|
+
{
|
|
66
|
+
inTrialMode.RemoveListener(EvaluateInTrialState);
|
|
67
|
+
|
|
68
|
+
inCGMode.RemoveListener(EvaluateInCGState);
|
|
69
|
+
|
|
70
|
+
inVideoMode.RemoveListener(EvaluateInCGState);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
///
|
|
75
|
+
/// </summary>
|
|
76
|
+
/// <param name="inTrial"></param>
|
|
77
|
+
protected virtual void EvaluateInTrialState(bool inTrial) => EnableCamerasTo(!inTrial);
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
///
|
|
81
|
+
/// </summary>
|
|
82
|
+
/// <param name="inCG"></param>
|
|
83
|
+
protected virtual void EvaluateInCGState(bool inCG)
|
|
84
|
+
{
|
|
85
|
+
if (!inTrialMode.Value)
|
|
86
|
+
EnableCamerasTo(!inCG);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
/// <param name="to"></param>
|
|
93
|
+
protected virtual void EnableCamerasTo(bool to)
|
|
94
|
+
{
|
|
95
|
+
foreach (BoolWithEvent camera in cameras)
|
|
96
|
+
if (camera != null)
|
|
97
|
+
camera.SetValue(to);
|
|
98
|
+
else
|
|
99
|
+
UnityEngine.Debug.Log($"{ToString()}: Canvases and Cameras states were not changed because " +
|
|
100
|
+
"a dialogue camera has not been found.");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class FloatWithEventListener : ValueWithEventListener<FloatWithEvent, float, FloatEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class FloatWithEventOnTitleScreen : ValueWithEventOnTitleScreen<float, FloatEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
[ClassHeader("")]
|
|
10
|
+
public class IntWithEventIndexListener : IntWithEventListener
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[Tooltip("")]
|
|
16
|
+
[SerializeField] protected int index = 0;
|
|
17
|
+
|
|
18
|
+
/// <inheritdoc/>
|
|
19
|
+
protected override void OnValueChanged(int updatedValue)
|
|
20
|
+
{
|
|
21
|
+
if (updatedValue == index)
|
|
22
|
+
base.OnValueChanged(updatedValue);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class IntWithEventListener : ValueWithEventListener<IntWithEvent, int, IntEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class IntWithEventOnTitleScreen : ValueWithEventOnTitleScreen<int, IntEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.EventObjectServices
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
/// <remarks></remarks>
|
|
11
|
+
public class InverseObjectStateBoolWithEvent : MonoBehaviour
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Header("")]
|
|
17
|
+
|
|
18
|
+
[Space]
|
|
19
|
+
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected BoolWithEvent boolWithEvent = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected GameObject objectToSet = null;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
protected virtual void OnEnable() => boolWithEvent.AddListener(OnLeavingState);
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected virtual void OnDisable() => boolWithEvent.RemoveListener(OnLeavingState);
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
/// <param name="state"></param>
|
|
44
|
+
protected virtual void OnLeavingState(bool state)
|
|
45
|
+
{
|
|
46
|
+
if (objectToSet != null)
|
|
47
|
+
objectToSet.SetActive(!state);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.Serialization;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.EventObjectServices
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader("")]
|
|
13
|
+
public class ObjectActiveOnChapterIndex : SceneEventListener
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Space]
|
|
19
|
+
|
|
20
|
+
[Space]
|
|
21
|
+
|
|
22
|
+
[Header("")]
|
|
23
|
+
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected IntWithEvent currentChapterIndex = null;
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Space]
|
|
31
|
+
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected bool setObjectsActiveTo = false;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Space]
|
|
39
|
+
|
|
40
|
+
[FormerlySerializedAs("visibleChapterIndex")]
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected List<int> visibleChapterIndexes = new();
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected List<GameObject> gameObjects = new();
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/// <inheritdoc/>
|
|
52
|
+
public override void OnEventRaised()
|
|
53
|
+
{
|
|
54
|
+
base.OnEventRaised();
|
|
55
|
+
|
|
56
|
+
CheckLoad();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
///
|
|
61
|
+
/// </summary>
|
|
62
|
+
protected virtual void CheckLoad()
|
|
63
|
+
{
|
|
64
|
+
if (ChapterMatchesVisibilityIndex())
|
|
65
|
+
SetGameObjectsActive();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
/// <returns></returns>
|
|
72
|
+
protected virtual bool ChapterMatchesVisibilityIndex()
|
|
73
|
+
=> visibleChapterIndexes.Contains(currentChapterIndex.Value);
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
///
|
|
77
|
+
/// </summary>
|
|
78
|
+
protected virtual void SetGameObjectsActive()
|
|
79
|
+
{
|
|
80
|
+
foreach (var go in gameObjects)
|
|
81
|
+
go.SetActive(setObjectsActiveTo);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Services;
|
|
4
|
+
using TMPro;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.EventObjectServices
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader(nameof(StringWithEventListener) + ", " + nameof(IToTitleScreen) +
|
|
13
|
+
"\n\n")]
|
|
14
|
+
public class ObjectNameDisplayer : StringWithEventListener, IToTitleScreen
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Space]
|
|
20
|
+
|
|
21
|
+
[Header("")]
|
|
22
|
+
[Divider]
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected BoolWithEvent displayNameVisible = null;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected TextMeshProUGUI displayText = null;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/// <inheritdoc/>
|
|
34
|
+
protected override void OnValueChanged(string updatedValue)
|
|
35
|
+
{
|
|
36
|
+
base.OnValueChanged(updatedValue);
|
|
37
|
+
|
|
38
|
+
if (updatedValue != "")
|
|
39
|
+
displayText.text = updatedValue;
|
|
40
|
+
|
|
41
|
+
displayNameVisible.SetValue(updatedValue != "");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// <inheritdoc/>
|
|
45
|
+
public virtual void ToTitleScreen() => displayNameVisible.SetValue(false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using TMPro;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.Events;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.EventObjectServices
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
/// <typeparam name="TX"></typeparam>
|
|
13
|
+
/// <typeparam name="TY"></typeparam>
|
|
14
|
+
public abstract class OptionWithEventListener<TX, TY> : ValueWithEventListener<OptionWithEvent<TX, TY>, TX, TY>, IOptionEventListener,
|
|
15
|
+
ISceneEventListener
|
|
16
|
+
where TY : UnityEvent<TX>, new()
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected SceneEvent newGameSelected = null;
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected TMP_Text displayNameText;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
public virtual void Initialize(IOptionEvent option)
|
|
32
|
+
{
|
|
33
|
+
if (displayNameText != null && displayNameText.gameObject.activeSelf)
|
|
34
|
+
displayNameText.text = option.OptionDisplayName;
|
|
35
|
+
|
|
36
|
+
valueWithEvent = option as OptionWithEvent<TX, TY>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
protected override void OnEnable()
|
|
40
|
+
{
|
|
41
|
+
base.OnEnable();
|
|
42
|
+
|
|
43
|
+
if (newGameSelected != null)
|
|
44
|
+
newGameSelected.RegisterListener(this);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected override void OnDisable()
|
|
48
|
+
{
|
|
49
|
+
base.OnEnable();
|
|
50
|
+
|
|
51
|
+
if (newGameSelected != null)
|
|
52
|
+
newGameSelected.UnregisterListener(this);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public virtual void OnEventRaised() => valueWithEvent.SetValue(valueWithEvent.InitialValue);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.EventObjectServices
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
[RequireComponent(typeof(CharacterController))]
|
|
11
|
+
[ClassHeader("")]
|
|
12
|
+
public class ResetCharacterControllerOnEvent : SceneEventListener
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected CharacterController characterController = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected Vector3 resetPosition = new(0, 1.5f, 0);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <inheritdoc/>
|
|
28
|
+
public override void OnEventRaised()
|
|
29
|
+
{
|
|
30
|
+
base.OnEventRaised();
|
|
31
|
+
|
|
32
|
+
ResetCharacterControllerPosition();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected void ResetCharacterControllerPosition()
|
|
39
|
+
{
|
|
40
|
+
characterController.enabled = false;
|
|
41
|
+
|
|
42
|
+
characterController.gameObject.transform.position = resetPosition;
|
|
43
|
+
|
|
44
|
+
characterController.enabled = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|