net.dreditor.talkables 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/DREditor.Talkables.asmdef +19 -0
- package/DREditor.Talkables.asmdef.meta +7 -0
- package/ItemActor.cs +200 -0
- package/ItemActor.cs.meta +11 -0
- package/LookAtObjectOnSelection.cs +253 -0
- package/LookAtObjectOnSelection.cs.meta +11 -0
- package/MoveData.cs +49 -0
- package/MoveData.cs.meta +11 -0
- package/Moveable.cs +42 -0
- package/Moveable.cs.meta +11 -0
- package/PanToTalkableEvent.cs +53 -0
- package/PanToTalkableEvent.cs.meta +11 -0
- package/Samples~/Look_At_Object_On_Selection.prefab +56 -0
- package/Samples~/Look_At_Object_On_Selection.prefab.meta +7 -0
- package/Samples~/Pan_To_Talkable_Event.prefab +49 -0
- package/Samples~/Pan_To_Talkable_Event.prefab.meta +7 -0
- package/SpriteLookAtTarget.cs +171 -0
- package/SpriteLookAtTarget.cs.meta +11 -0
- package/Talkable.cs +153 -0
- package/Talkable.cs.meta +11 -0
- package/package.json +40 -4
- package/package.json.meta +7 -0
- package/README.md +0 -3
package/.attestation.p7m
ADDED
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Talkables",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"DREditor",
|
|
6
|
+
"DREditor.Progressing.Handling",
|
|
7
|
+
"DREditor.LocalDialogues",
|
|
8
|
+
"DREditor.DialogueEventHandling"
|
|
9
|
+
],
|
|
10
|
+
"includePlatforms": [],
|
|
11
|
+
"excludePlatforms": [],
|
|
12
|
+
"allowUnsafeCode": false,
|
|
13
|
+
"overrideReferences": false,
|
|
14
|
+
"precompiledReferences": [],
|
|
15
|
+
"autoReferenced": true,
|
|
16
|
+
"defineConstraints": [],
|
|
17
|
+
"versionDefines": [],
|
|
18
|
+
"noEngineReferences": false
|
|
19
|
+
}
|
package/ItemActor.cs
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Dialogues.Events;
|
|
4
|
+
using DREditor.LocalDialogues;
|
|
5
|
+
using DREditor.Services;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Talkables
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
[ClassHeader(nameof(Talkable) +
|
|
15
|
+
"\n\n")]
|
|
16
|
+
public class ItemActor : Talkable
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected string toggleBlurEventString = "ToggleBlur";
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
public bool isStaticItem = false;
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Tooltip("")]
|
|
34
|
+
[SerializeField] protected List<GameObject> observeAddOnObjects = new();
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
[Header("")]
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected int defaultLayerIndex = 0;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected int itemLayerIndex = 11;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Tooltip("")]
|
|
54
|
+
[SerializeField] protected int addOnLayerIndex = 16;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/// <inheritdoc/>
|
|
58
|
+
protected override void Start()
|
|
59
|
+
{
|
|
60
|
+
base.Start();
|
|
61
|
+
|
|
62
|
+
LocalDialogueHandlerBase.BookOfTriggers.Add(gameObject.name, this);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// <inheritdoc/>
|
|
66
|
+
protected override void OnDestroy()
|
|
67
|
+
{
|
|
68
|
+
LocalDialogueHandlerBase.BookOfTriggers.Remove(gameObject.name);
|
|
69
|
+
|
|
70
|
+
base.OnDestroy();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
///
|
|
76
|
+
/// </summary>
|
|
77
|
+
public virtual void ClearItemData()
|
|
78
|
+
{
|
|
79
|
+
if (!isStaticItem)
|
|
80
|
+
{
|
|
81
|
+
conversations.Clear();
|
|
82
|
+
|
|
83
|
+
selectable = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/// <inheritdoc/>
|
|
89
|
+
public override void SelectObject()
|
|
90
|
+
{
|
|
91
|
+
DialogueEventSystem.TriggerEvent(toggleBlurEventString, false);
|
|
92
|
+
|
|
93
|
+
Dialogue[] conversation = new Dialogue[1];
|
|
94
|
+
|
|
95
|
+
Dialogue dialogue = EvaluateDialogueWhereTriggeredFlagIsItem();
|
|
96
|
+
|
|
97
|
+
conversation[0] = dialogue != null ?
|
|
98
|
+
dialogue : ServiceLocator.GetService<LocalDialogueHandlerBase>().EvaluateDialogue(conversations);
|
|
99
|
+
|
|
100
|
+
InvokeConversation(conversation);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
///
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <remarks>
|
|
107
|
+
///
|
|
108
|
+
/// </remarks>
|
|
109
|
+
/// <returns></returns>
|
|
110
|
+
protected virtual Dialogue EvaluateDialogueWhereTriggeredFlagIsItem()
|
|
111
|
+
{
|
|
112
|
+
foreach (LocalDialogue localDialogue in conversations)
|
|
113
|
+
if (!localDialogue.triggered &&
|
|
114
|
+
localDialogue.requiredProgressionFlag != "" &&
|
|
115
|
+
ServiceLocator.GetService<IObjectPooler<Talkable>>() is IObjectPooler<Talkable> pooler &&
|
|
116
|
+
pooler.GetObjectByName(localDialogue.requiredProgressionFlag) is Talkable talkable)
|
|
117
|
+
return GetDialogueThroughEvaluation(localDialogue, talkable.conversations.ContainsTriggeredDialogue());
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
///
|
|
124
|
+
/// </summary>
|
|
125
|
+
/// <param name="localDialogue"></param>
|
|
126
|
+
/// <param name="evaluation"></param>
|
|
127
|
+
/// <returns></returns>
|
|
128
|
+
protected virtual Dialogue GetDialogueThroughEvaluation(LocalDialogue localDialogue, bool evaluation)
|
|
129
|
+
{
|
|
130
|
+
if (evaluation)
|
|
131
|
+
localDialogue.SetTriggered();
|
|
132
|
+
|
|
133
|
+
return evaluation ? localDialogue.dialogue : localDialogue.dialogueIfFlagNotMet;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/// <inheritdoc/>
|
|
138
|
+
public override void SetSelectability(bool selectable)
|
|
139
|
+
{
|
|
140
|
+
// Added 1/1/2025 as a way to disable items if they have no usable dialogue.
|
|
141
|
+
// however, below code might have an adverse reaction and functionality to disable
|
|
142
|
+
// items if there's no usuable dialogue should be added during the next Rework.
|
|
143
|
+
//if (RoomConvo.Count == 0)
|
|
144
|
+
//{
|
|
145
|
+
// to = false;
|
|
146
|
+
//}
|
|
147
|
+
// Revisited this during the 2025 Rework 10/16/2025 and I'm going to leave this for another rework.
|
|
148
|
+
|
|
149
|
+
if (selectable == base.selectable && gameObject.layer == (selectable ? itemLayerIndex : defaultLayerIndex))
|
|
150
|
+
return;
|
|
151
|
+
|
|
152
|
+
gameObject.layer = selectable ? itemLayerIndex : defaultLayerIndex;
|
|
153
|
+
|
|
154
|
+
foreach (Transform child in gameObject.transform)
|
|
155
|
+
child.gameObject.layer = selectable ? itemLayerIndex : defaultLayerIndex;
|
|
156
|
+
|
|
157
|
+
foreach (GameObject observeAddOnObject in observeAddOnObjects)
|
|
158
|
+
observeAddOnObject.layer = selectable ? addOnLayerIndex : defaultLayerIndex;
|
|
159
|
+
|
|
160
|
+
base.SetSelectability(selectable);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// <summary>
|
|
164
|
+
///
|
|
165
|
+
/// </summary>
|
|
166
|
+
[ContextMenu("Create Head, Body, and Set Layer")]
|
|
167
|
+
public virtual void EditorInstantiation()
|
|
168
|
+
{
|
|
169
|
+
DisplayName = gameObject.name;
|
|
170
|
+
|
|
171
|
+
gameObject.layer = itemLayerIndex;
|
|
172
|
+
|
|
173
|
+
gameObject.AddComponent<BoxCollider>();
|
|
174
|
+
|
|
175
|
+
GameObject head = CreateChild("_Head");
|
|
176
|
+
|
|
177
|
+
GameObject body = CreateChild("_Body");
|
|
178
|
+
|
|
179
|
+
SetHeadAndBody(head.transform, body.transform);
|
|
180
|
+
|
|
181
|
+
body.transform.position = new Vector3(0, 0, -2);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// <summary>
|
|
185
|
+
///
|
|
186
|
+
/// </summary>
|
|
187
|
+
/// <param name="suffix"></param>
|
|
188
|
+
/// <returns></returns>
|
|
189
|
+
protected virtual GameObject CreateChild(string suffix)
|
|
190
|
+
{
|
|
191
|
+
string objectName = gameObject.name.Replace(" ", "_");
|
|
192
|
+
|
|
193
|
+
GameObject child = new(objectName + suffix);
|
|
194
|
+
|
|
195
|
+
child.transform.parent = gameObject.transform;
|
|
196
|
+
|
|
197
|
+
return child;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if DOTWEEN
|
|
3
|
+
using DG.Tweening;
|
|
4
|
+
#endif
|
|
5
|
+
using DREditor.Dialogues;
|
|
6
|
+
using DREditor.Dialogues.Ending;
|
|
7
|
+
using DREditor.Dialogues.Events;
|
|
8
|
+
using DREditor.Dialogues.Finishing;
|
|
9
|
+
using DREditor.Dialogues.Starting;
|
|
10
|
+
using DREditor.EventObjects;
|
|
11
|
+
using DREditor.Services;
|
|
12
|
+
using System.Collections;
|
|
13
|
+
using UnityEngine;
|
|
14
|
+
|
|
15
|
+
namespace DREditor.Talkables
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[ClassHeader(nameof(IPreparableDialogueComponent) + ", " + nameof(IResolvableDialogueComponent) + ", "
|
|
21
|
+
+ nameof(IFinishableDialogueComponent) +
|
|
22
|
+
"\n\n")]
|
|
23
|
+
public class LookAtObjectOnSelection : DialogueComponent, IPreparableDialogueComponent, IResolvableDialogueComponent,
|
|
24
|
+
IFinishableDialogueComponent, IToTitleScreen
|
|
25
|
+
{
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected float prepareOrder = 1;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected float resolveOrder = 1;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected float finishOrder = 4;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected int finishPreparerID = 2;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Tooltip("")]
|
|
54
|
+
[SerializeField] protected BoolWithEvent inDialogue = null;
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
[Tooltip("")]
|
|
60
|
+
[SerializeField] protected BoolWithEvent inTPFD = null;
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
[Tooltip("")]
|
|
66
|
+
[SerializeField] protected BoolWithEvent isLoadingFile = null;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/// <summary>
|
|
70
|
+
///
|
|
71
|
+
/// </summary>
|
|
72
|
+
[Header("")]
|
|
73
|
+
[Divider]
|
|
74
|
+
[Tooltip("")]
|
|
75
|
+
[SerializeField] protected string dialogueCameraToMainEventString = "DialogueCameraToMainCamera";
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
///
|
|
79
|
+
/// </summary>
|
|
80
|
+
[Tooltip("")]
|
|
81
|
+
[SerializeField] protected string mainCameraTag = "MainCamera";
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
///
|
|
85
|
+
/// </summary>
|
|
86
|
+
[Tooltip("")]
|
|
87
|
+
[SerializeField] protected float lookAtPlayerTime = 1;
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/// <summary>
|
|
91
|
+
///
|
|
92
|
+
/// </summary>
|
|
93
|
+
/// <remarks>
|
|
94
|
+
///
|
|
95
|
+
/// </remarks>
|
|
96
|
+
protected bool skipOGCamLook = false;
|
|
97
|
+
|
|
98
|
+
/// <summary>
|
|
99
|
+
///
|
|
100
|
+
/// </summary>
|
|
101
|
+
protected Quaternion originalCameraLookRotation;
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
float IDialogueComponent<IPreparableDialogueComponent>.Order { get => prepareOrder; }
|
|
105
|
+
|
|
106
|
+
float IDialogueComponent<IResolvableDialogueComponent>.Order { get => resolveOrder; }
|
|
107
|
+
|
|
108
|
+
float IDialogueComponent<IFinishableDialogueComponent>.Order { get => finishOrder; }
|
|
109
|
+
|
|
110
|
+
int IDialogueComponent<IFinishableDialogueComponent>.ExclusiveHandlerID => finishPreparerID;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/// <summary>
|
|
114
|
+
///
|
|
115
|
+
/// </summary>
|
|
116
|
+
protected virtual void OnEnable() => DialogueEventSystem.StartListening("PostToTPFDFromDialogue", OnCameraSet);
|
|
117
|
+
|
|
118
|
+
/// <summary>
|
|
119
|
+
///
|
|
120
|
+
/// </summary>
|
|
121
|
+
protected virtual void OnDisable() => DialogueEventSystem.StopListening("PostToTPFDFromDialogue", OnCameraSet);
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
///
|
|
125
|
+
/// </summary>
|
|
126
|
+
/// <param name="o"></param>
|
|
127
|
+
protected virtual void OnCameraSet(object o = null) => SetOGLookToMainCamera();
|
|
128
|
+
|
|
129
|
+
/// <summary>
|
|
130
|
+
///
|
|
131
|
+
/// </summary>
|
|
132
|
+
protected virtual void SetOGLookToMainCamera()
|
|
133
|
+
=> originalCameraLookRotation = GameObject.FindWithTag(mainCameraTag).transform.rotation;
|
|
134
|
+
|
|
135
|
+
/// <summary>
|
|
136
|
+
///
|
|
137
|
+
/// </summary>
|
|
138
|
+
protected virtual void DisableSkipOGCameraLook() => skipOGCamLook = false;
|
|
139
|
+
|
|
140
|
+
/// <summary>
|
|
141
|
+
///
|
|
142
|
+
/// </summary>
|
|
143
|
+
protected virtual void ReturnToOriginalPosition()
|
|
144
|
+
{
|
|
145
|
+
if (!skipOGCamLook)
|
|
146
|
+
#if DOTWEEN
|
|
147
|
+
GameObject.FindWithTag(mainCameraTag).transform.DORotateQuaternion(originalCameraLookRotation, lookAtPlayerTime);
|
|
148
|
+
#else
|
|
149
|
+
GameObject.FindWithTag(mainCameraTag).transform.Rotate(originalCameraLookRotation.eulerAngles);
|
|
150
|
+
#endif
|
|
151
|
+
else
|
|
152
|
+
DisableSkipOGCameraLook();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// <summary>
|
|
156
|
+
///
|
|
157
|
+
/// </summary>
|
|
158
|
+
protected virtual void CheckSkippingOGCam()
|
|
159
|
+
{
|
|
160
|
+
if (skipOGCamLook)
|
|
161
|
+
DisableSkipOGCameraLook();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// <summary>
|
|
165
|
+
///
|
|
166
|
+
/// </summary>
|
|
167
|
+
/// <returns></returns>
|
|
168
|
+
protected virtual IEnumerator LookAtSelectedObjectProcess()
|
|
169
|
+
{
|
|
170
|
+
Talkable selectedObject = ServiceLocator.GetService<DialogueObjectManager>().GetStartObject() as Talkable;
|
|
171
|
+
|
|
172
|
+
PrepareCameraPositionsForDialogueStart();
|
|
173
|
+
|
|
174
|
+
if (!inTPFD.Value)
|
|
175
|
+
LookAtHead(selectedObject);
|
|
176
|
+
|
|
177
|
+
if (!isLoadingFile.Value)
|
|
178
|
+
yield return new WaitForSeconds(lookAtPlayerTime);
|
|
179
|
+
|
|
180
|
+
yield break;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/// <summary>
|
|
184
|
+
///
|
|
185
|
+
/// </summary>
|
|
186
|
+
protected virtual void PrepareCameraPositionsForDialogueStart()
|
|
187
|
+
{
|
|
188
|
+
if (isLoadingFile.Value)
|
|
189
|
+
EnableSkipOGCameraLook();
|
|
190
|
+
else
|
|
191
|
+
DialogueEventSystem.TriggerEvent(dialogueCameraToMainEventString);
|
|
192
|
+
|
|
193
|
+
SetOGLookToMainCamera();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/// <summary>
|
|
197
|
+
///
|
|
198
|
+
/// </summary>
|
|
199
|
+
protected virtual void EnableSkipOGCameraLook() => skipOGCamLook = true;
|
|
200
|
+
|
|
201
|
+
/// <summary>
|
|
202
|
+
///
|
|
203
|
+
/// </summary>
|
|
204
|
+
/// <param name="talkable"></param>
|
|
205
|
+
protected virtual void LookAtHead(Talkable talkable)
|
|
206
|
+
{
|
|
207
|
+
if (talkable == null)
|
|
208
|
+
return;
|
|
209
|
+
|
|
210
|
+
if (!talkable.head)
|
|
211
|
+
UnityEngine.Debug.LogWarning("ALERT: " + talkable.gameObject.name + " doesn't have a head initialized.");
|
|
212
|
+
else
|
|
213
|
+
#if DOTWEEN
|
|
214
|
+
GameObject.FindWithTag(mainCameraTag).transform.DOLookAt(talkable.head.position, lookAtPlayerTime);
|
|
215
|
+
#else
|
|
216
|
+
GameObject.FindWithTag(mainCameraTag).transform.LookAt(talkable.head.position);
|
|
217
|
+
#endif
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
/// <inheritdoc/>
|
|
222
|
+
public virtual bool UseRoutineToPrepare() => true;
|
|
223
|
+
|
|
224
|
+
/// <inheritdoc/>
|
|
225
|
+
public virtual void Prepare() => StartCoroutine(PrepareRoutine());
|
|
226
|
+
|
|
227
|
+
/// <inheritdoc/>
|
|
228
|
+
public virtual IEnumerator PrepareRoutine() => LookAtSelectedObjectProcess();
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
/// <inheritdoc/>
|
|
232
|
+
public virtual bool UseRoutineToResolve() => false;
|
|
233
|
+
|
|
234
|
+
/// <inheritdoc/>
|
|
235
|
+
public virtual void Resolve() => ReturnToOriginalPosition();
|
|
236
|
+
|
|
237
|
+
/// <inheritdoc/>
|
|
238
|
+
public virtual IEnumerator ResolveRoutine()
|
|
239
|
+
{
|
|
240
|
+
Resolve();
|
|
241
|
+
|
|
242
|
+
yield break;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
/// <inheritdoc/>
|
|
247
|
+
public virtual void OnFinishDialogue() => CheckSkippingOGCam();
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
/// <inheritdoc/>
|
|
251
|
+
public virtual void ToTitleScreen() => DisableSkipOGCameraLook();
|
|
252
|
+
}
|
|
253
|
+
}
|
package/MoveData.cs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using System;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.Talkables
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
[Serializable]
|
|
11
|
+
public class MoveData
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Tooltip("")]
|
|
17
|
+
public string name;
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Tooltip("")]
|
|
23
|
+
public Vector3 position;
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
[Tooltip("")]
|
|
29
|
+
public Vector3 rotation;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
public MoveData() { }
|
|
33
|
+
|
|
34
|
+
public MoveData(string name, Vector3 position, Vector3 rotation)
|
|
35
|
+
{
|
|
36
|
+
this.name = name;
|
|
37
|
+
|
|
38
|
+
this.position = position;
|
|
39
|
+
|
|
40
|
+
this.rotation = rotation;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <returns></returns>
|
|
47
|
+
public virtual object Clone() => MemberwiseClone();
|
|
48
|
+
}
|
|
49
|
+
}
|
package/MoveData.cs.meta
ADDED
package/Moveable.cs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.Talkables
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
[ClassHeader("")]
|
|
10
|
+
public class Moveable : MonoBehaviour
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[HideInInspector] protected MoveData place = new();
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
/// <returns></returns>
|
|
22
|
+
public virtual MoveData Save()
|
|
23
|
+
{
|
|
24
|
+
place = new(gameObject.name, transform.position, transform.eulerAngles);
|
|
25
|
+
|
|
26
|
+
return (MoveData)place.Clone();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
/// <param name="place"></param>
|
|
33
|
+
public virtual void Load(MoveData place)
|
|
34
|
+
{
|
|
35
|
+
this.place = place;
|
|
36
|
+
|
|
37
|
+
transform.position = place.position;
|
|
38
|
+
|
|
39
|
+
transform.eulerAngles = place.rotation;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/Moveable.cs.meta
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.DialogueEventHandling;
|
|
3
|
+
using DREditor.Dialogues.Events;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Talkables
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader(nameof(DialogueEventHandler) +
|
|
12
|
+
"\n\n")]
|
|
13
|
+
public class PanToTalkableEvent : DialogueEventHandler
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected string toggleBlurEventString = "ToggleBlur";
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected string dialogueEventStringMoveCamera = "PanToObject";
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
/// <param name="o"></param>
|
|
32
|
+
protected override void OnDialogueEventTriggered(object o = null)
|
|
33
|
+
{
|
|
34
|
+
if (o == null)
|
|
35
|
+
UnityEngine.Debug.LogWarning($"REPORT: {ToString()}: Sent talkable was null.");
|
|
36
|
+
|
|
37
|
+
Talkable talkable = (Talkable)o;
|
|
38
|
+
|
|
39
|
+
if (talkable is not ItemActor)
|
|
40
|
+
DialogueEventSystem.TriggerEvent(toggleBlurEventString, true);
|
|
41
|
+
|
|
42
|
+
if (talkable != null)
|
|
43
|
+
DialogueEventSystem.TriggerEvent(dialogueEventStringMoveCamera, talkable.body);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
[ContextMenu("Set Default Event")]
|
|
51
|
+
public void SetDefaultEvent() => SetDefaultEventString("PanToTalkable");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &8805768200422373649
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 8805768200422373648}
|
|
12
|
+
- component: {fileID: 8805768200422373871}
|
|
13
|
+
m_Layer: 0
|
|
14
|
+
m_Name: Look_At_Object_On_Selection
|
|
15
|
+
m_TagString: Untagged
|
|
16
|
+
m_Icon: {fileID: 0}
|
|
17
|
+
m_NavMeshLayer: 0
|
|
18
|
+
m_StaticEditorFlags: 0
|
|
19
|
+
m_IsActive: 1
|
|
20
|
+
--- !u!4 &8805768200422373648
|
|
21
|
+
Transform:
|
|
22
|
+
m_ObjectHideFlags: 0
|
|
23
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
24
|
+
m_PrefabInstance: {fileID: 0}
|
|
25
|
+
m_PrefabAsset: {fileID: 0}
|
|
26
|
+
m_GameObject: {fileID: 8805768200422373649}
|
|
27
|
+
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
|
28
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
29
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
30
|
+
m_ConstrainProportionsScale: 0
|
|
31
|
+
m_Children: []
|
|
32
|
+
m_Father: {fileID: 0}
|
|
33
|
+
m_RootOrder: 0
|
|
34
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
35
|
+
--- !u!114 &8805768200422373871
|
|
36
|
+
MonoBehaviour:
|
|
37
|
+
m_ObjectHideFlags: 0
|
|
38
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
39
|
+
m_PrefabInstance: {fileID: 0}
|
|
40
|
+
m_PrefabAsset: {fileID: 0}
|
|
41
|
+
m_GameObject: {fileID: 8805768200422373649}
|
|
42
|
+
m_Enabled: 1
|
|
43
|
+
m_EditorHideFlags: 0
|
|
44
|
+
m_Script: {fileID: 11500000, guid: 3b8f413b18872e648a74a6bf8378b84c, type: 3}
|
|
45
|
+
m_Name:
|
|
46
|
+
m_EditorClassIdentifier:
|
|
47
|
+
prepareOrder: 1
|
|
48
|
+
resolveOrder: 1
|
|
49
|
+
finishOrder: 4
|
|
50
|
+
finishPreparerID: 2
|
|
51
|
+
inDialogue: {fileID: 11400000, guid: b2839fc222ba4bc4eb8bcfee73b0c53d, type: 2}
|
|
52
|
+
inTPFD: {fileID: 11400000, guid: 7f90df5202cae904292188e37c9076d3, type: 2}
|
|
53
|
+
isLoadingFile: {fileID: 11400000, guid: 1d94fdc8796dc9f43b2a3bedb0f5d4dd, type: 2}
|
|
54
|
+
dialogueCameraToMainEventString: DialogueCameraToMainCamera
|
|
55
|
+
mainCameraTag: MainCamera
|
|
56
|
+
lookAtPlayerTime: 1
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &454916263186187600
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 454916263186187601}
|
|
12
|
+
- component: {fileID: 454916263186187602}
|
|
13
|
+
m_Layer: 0
|
|
14
|
+
m_Name: Pan_To_Talkable_Event
|
|
15
|
+
m_TagString: Untagged
|
|
16
|
+
m_Icon: {fileID: 0}
|
|
17
|
+
m_NavMeshLayer: 0
|
|
18
|
+
m_StaticEditorFlags: 0
|
|
19
|
+
m_IsActive: 1
|
|
20
|
+
--- !u!4 &454916263186187601
|
|
21
|
+
Transform:
|
|
22
|
+
m_ObjectHideFlags: 0
|
|
23
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
24
|
+
m_PrefabInstance: {fileID: 0}
|
|
25
|
+
m_PrefabAsset: {fileID: 0}
|
|
26
|
+
m_GameObject: {fileID: 454916263186187600}
|
|
27
|
+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
28
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
29
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
30
|
+
m_ConstrainProportionsScale: 0
|
|
31
|
+
m_Children: []
|
|
32
|
+
m_Father: {fileID: 0}
|
|
33
|
+
m_RootOrder: 0
|
|
34
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
35
|
+
--- !u!114 &454916263186187602
|
|
36
|
+
MonoBehaviour:
|
|
37
|
+
m_ObjectHideFlags: 0
|
|
38
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
39
|
+
m_PrefabInstance: {fileID: 0}
|
|
40
|
+
m_PrefabAsset: {fileID: 0}
|
|
41
|
+
m_GameObject: {fileID: 454916263186187600}
|
|
42
|
+
m_Enabled: 1
|
|
43
|
+
m_EditorHideFlags: 0
|
|
44
|
+
m_Script: {fileID: 11500000, guid: 4025664e1e212e8428d4e0cfaa874dcf, type: 3}
|
|
45
|
+
m_Name:
|
|
46
|
+
m_EditorClassIdentifier:
|
|
47
|
+
dialogueEventString: PanToTalkable
|
|
48
|
+
toggleBlurEventString: ToggleBlur
|
|
49
|
+
dialogueEventStringMoveCamera: PanToObject
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
//Completely Reworked Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
//Original Author: Redberd36
|
|
3
|
+
//Sorry Red I ended up completely reworking this.
|
|
4
|
+
using DREditor.Dialogues;
|
|
5
|
+
using DREditor.EventObjects;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Talkables
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
[ClassHeader("")]
|
|
15
|
+
public class SpriteLookAtTarget : MonoBehaviour
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected BoolWithEvent inDialogue = null;
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected BoolWithEvent isLoadingFile = null;
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected BoolWithEvent inTPFD = null;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Tooltip("")]
|
|
39
|
+
[SerializeField] protected BoolWithEvent inThreeDMode = null;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
[Header("")]
|
|
46
|
+
[Divider]
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected bool mimicOG = false;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Tooltip("")]
|
|
54
|
+
[SerializeField] protected bool ignoreReaderCheck = false;
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
[Tooltip("")]
|
|
60
|
+
[SerializeField] protected string mainCameraTag = "MainCamera";
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/// <summary>
|
|
64
|
+
///
|
|
65
|
+
/// </summary>
|
|
66
|
+
protected bool shouldLookAtTarget;
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
protected Transform target;
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
///
|
|
75
|
+
/// </summary>
|
|
76
|
+
protected IDialogueManager dialogueManager;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
///
|
|
81
|
+
/// </summary>
|
|
82
|
+
protected virtual void OnEnable() => inTPFD.AddListener(UpdateLookingStatus);
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
///
|
|
86
|
+
/// </summary>
|
|
87
|
+
protected virtual void OnDisable() => inTPFD.RemoveListener(UpdateLookingStatus);
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
/// <param name="inTPFD"></param>
|
|
93
|
+
protected virtual void UpdateLookingStatus(bool inTPFD) => shouldLookAtTarget = !inTPFD;
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
///
|
|
97
|
+
/// </summary>
|
|
98
|
+
protected virtual void Start()
|
|
99
|
+
{
|
|
100
|
+
target = GameObject.FindWithTag(mainCameraTag).GetComponent<Transform>();
|
|
101
|
+
|
|
102
|
+
if (inThreeDMode.Value)
|
|
103
|
+
shouldLookAtTarget = true;
|
|
104
|
+
|
|
105
|
+
if (!ignoreReaderCheck)
|
|
106
|
+
dialogueManager = ServiceLocator.GetService<IDialogueManager>();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
protected virtual void FixedUpdate() => BillboardCheck();
|
|
113
|
+
|
|
114
|
+
/// <summary>
|
|
115
|
+
///
|
|
116
|
+
/// </summary>
|
|
117
|
+
protected virtual void BillboardCheck()
|
|
118
|
+
{
|
|
119
|
+
if (shouldLookAtTarget && !isLoadingFile.Value && !DialogueIsPlaying())
|
|
120
|
+
Billboard();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
///
|
|
125
|
+
/// </summary>
|
|
126
|
+
protected virtual void Billboard()
|
|
127
|
+
{
|
|
128
|
+
if (mimicOG)
|
|
129
|
+
MimicBillboard();
|
|
130
|
+
else
|
|
131
|
+
LookAtBillboard();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// <summary>
|
|
135
|
+
///
|
|
136
|
+
/// </summary>
|
|
137
|
+
/// <returns></returns>
|
|
138
|
+
protected virtual bool DialogueIsPlaying() => ignoreReaderCheck || dialogueManager == null || inDialogue.Value;
|
|
139
|
+
|
|
140
|
+
/// <summary>
|
|
141
|
+
///
|
|
142
|
+
/// </summary>
|
|
143
|
+
protected virtual void MimicBillboard()
|
|
144
|
+
{
|
|
145
|
+
Vector3 direction = target.transform.forward * -1;
|
|
146
|
+
|
|
147
|
+
SetRotation(direction);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// <summary>
|
|
151
|
+
///
|
|
152
|
+
/// </summary>
|
|
153
|
+
protected virtual void LookAtBillboard()
|
|
154
|
+
{
|
|
155
|
+
Vector3 direction = target.transform.position - transform.position;
|
|
156
|
+
|
|
157
|
+
SetRotation(direction);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/// <summary>
|
|
161
|
+
///
|
|
162
|
+
/// </summary>
|
|
163
|
+
/// <param name="direction"></param>
|
|
164
|
+
protected virtual void SetRotation(Vector3 direction)
|
|
165
|
+
{
|
|
166
|
+
transform.rotation = Quaternion.LookRotation(direction);
|
|
167
|
+
|
|
168
|
+
transform.rotation = Quaternion.Euler(0, transform.rotation.eulerAngles.y, 0);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
package/Talkable.cs
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Dialogues.Loading;
|
|
4
|
+
using DREditor.EventObjects;
|
|
5
|
+
using DREditor.LocalDialogues;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using System;
|
|
8
|
+
using System.Collections;
|
|
9
|
+
using System.Collections.Generic;
|
|
10
|
+
using UnityEngine;
|
|
11
|
+
using UnityEngine.Serialization;
|
|
12
|
+
|
|
13
|
+
namespace DREditor.Talkables
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
public abstract class Talkable : SelectableObject, IDialogueProgression, IDialogueHolder, ISkipConversation
|
|
19
|
+
{
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
public bool identified = true;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected string unidentifiedDisplayName = "???";
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[FormerlySerializedAs("RoomConvo")]
|
|
37
|
+
public List<LocalDialogue> conversations = new();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
public event Action<Talkable, Dialogue[]> StartConversation;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
/// <param name="action"></param>
|
|
50
|
+
public virtual void SubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation += action;
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <param name="action"></param>
|
|
56
|
+
public virtual void UnsubscribeToStartConversation(Action<Talkable, Dialogue[]> action) => StartConversation -= action;
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
///
|
|
60
|
+
/// </summary>
|
|
61
|
+
/// <param name="conversation"></param>
|
|
62
|
+
protected virtual void InvokeConversation(Dialogue[] conversation) => StartConversation?.Invoke(this, conversation);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
///
|
|
67
|
+
/// </summary>
|
|
68
|
+
protected virtual void Start() => Register(this);
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
///
|
|
72
|
+
/// </summary>
|
|
73
|
+
/// <typeparam name="T"></typeparam>
|
|
74
|
+
/// <param name="pooledObject"></param>
|
|
75
|
+
protected virtual void Register<T>(T pooledObject) where T : SelectableObject
|
|
76
|
+
{
|
|
77
|
+
ServiceLocator.GetService<IObjectPooler<SelectableObject>>()?.RegisterObject(pooledObject);
|
|
78
|
+
|
|
79
|
+
if (ServiceLocator.HasService<IObjectPooler<T>>())
|
|
80
|
+
ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
|
|
81
|
+
else
|
|
82
|
+
StartCoroutine(WaitForObjectPooler(pooledObject));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// <summary>
|
|
86
|
+
///
|
|
87
|
+
/// </summary>
|
|
88
|
+
/// <typeparam name="T"></typeparam>
|
|
89
|
+
/// <param name="pooledObject"></param>
|
|
90
|
+
/// <returns></returns>
|
|
91
|
+
protected virtual IEnumerator WaitForObjectPooler<T>(T pooledObject)
|
|
92
|
+
{
|
|
93
|
+
UnityEngine.Debug.LogWarning($"ALERT: Pooler for type: {typeof(T)} does not exist!");
|
|
94
|
+
|
|
95
|
+
UnityEngine.Debug.Log($" {typeof(T)} Started Waiting for: " + transform.parent.name);
|
|
96
|
+
|
|
97
|
+
yield return new WaitUntil(() => ServiceLocator.HasService<IObjectPooler<T>>());
|
|
98
|
+
|
|
99
|
+
ServiceLocator.GetService<IObjectPooler<T>>()?.RegisterObject(pooledObject);
|
|
100
|
+
|
|
101
|
+
UnityEngine.Debug.Log("Successfully waited for: " + transform.parent.name);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/// <summary>
|
|
106
|
+
///
|
|
107
|
+
/// </summary>
|
|
108
|
+
protected virtual void OnDestroy() => Unregister(this);
|
|
109
|
+
|
|
110
|
+
/// <summary>
|
|
111
|
+
///
|
|
112
|
+
/// </summary>
|
|
113
|
+
/// <typeparam name="T"></typeparam>
|
|
114
|
+
/// <param name="pooledObject"></param>
|
|
115
|
+
protected virtual void Unregister<T>(T pooledObject) where T : SelectableObject
|
|
116
|
+
{
|
|
117
|
+
if (ServiceLocator.HasService<IObjectPooler<SelectableObject>>(out var service))
|
|
118
|
+
service.UnregisterObject(pooledObject);
|
|
119
|
+
|
|
120
|
+
ServiceLocator.GetService<IObjectPooler<T>>()?.UnregisterObject(pooledObject);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/// <inheritdoc/>
|
|
125
|
+
public override string DisplayName => identified ? base.DisplayName : unidentifiedDisplayName;
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/// <inheritdoc/>
|
|
129
|
+
public virtual bool CheckIfSaveDialogue()
|
|
130
|
+
{
|
|
131
|
+
foreach (LocalDialogue localDialogue in conversations)
|
|
132
|
+
if (ServiceLocator.GetService<IDialogueManager>()
|
|
133
|
+
.GetManagerComponent<DialogueLoadIdentifier>()
|
|
134
|
+
.CheckDialogue<Line>(localDialogue.dialogue)
|
|
135
|
+
||
|
|
136
|
+
ServiceLocator.GetService<IDialogueManager>()
|
|
137
|
+
.GetManagerComponent<DialogueLoadIdentifier>()
|
|
138
|
+
.CheckDialogue<Line>(localDialogue.dialogueIfFlagNotMet))
|
|
139
|
+
return true;
|
|
140
|
+
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// <inheritdoc/>
|
|
145
|
+
public virtual void SkipConversation(int conversationIndex) => conversations[conversationIndex].SetTriggered();
|
|
146
|
+
|
|
147
|
+
/// <inheritdoc/>
|
|
148
|
+
public virtual bool AllDialogueTriggered() => conversations.AllDialogueTriggered();
|
|
149
|
+
|
|
150
|
+
/// <inheritdoc/>
|
|
151
|
+
public virtual bool HasUnTriggeredRequiredFlags() => conversations.HasUnTriggeredRequiredFlags();
|
|
152
|
+
}
|
|
153
|
+
}
|
package/Talkable.cs.meta
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "net.dreditor.talkables",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"displayName": "DREditor Talkables",
|
|
5
|
+
"description": "The beta for DREditor. A tool to create death game style projects without having to code.",
|
|
6
|
+
"unity": "6000.4",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"net.dreditor.core": "0.1.7",
|
|
9
|
+
"net.dreditor.progressing.handling": "0.1.7",
|
|
10
|
+
"net.dreditor.localdialogues": "0.1.7",
|
|
11
|
+
"net.dreditor.dialogueeventhandling": "0.1.7"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Benjamin \"Sweden\" Jillson",
|
|
18
|
+
"email": "dreditortool@gmail.com",
|
|
19
|
+
"url": "https://dreditor.net"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"editor",
|
|
23
|
+
"tool",
|
|
24
|
+
"dreditor"
|
|
25
|
+
],
|
|
26
|
+
"samples": [
|
|
27
|
+
{
|
|
28
|
+
"displayName": "Samples",
|
|
29
|
+
"description": "",
|
|
30
|
+
"path": "Samples~"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"documentationUrl": "https://dreditor.net",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"licensesUrl": "https://dreditor.net/docs/LICENSE.html",
|
|
36
|
+
"changelogUrl": "https://dreditor.net/docs/CHANGELOG.html",
|
|
37
|
+
"repository": {
|
|
38
|
+
"url": "https://github.com/CertifiedSharp/DREditor",
|
|
39
|
+
"type": "git",
|
|
40
|
+
"revision": "14ca252fbb33eb6f53557ecaed1c10902877698f"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/README.md
DELETED