net.dreditor.actors 0.0.0-stage → 0.1.6
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/Actor.cs +75 -0
- package/Actor.cs.meta +11 -0
- package/ActorBodyDebugger.cs +118 -0
- package/ActorBodyDebugger.cs.meta +13 -0
- package/ActorManager.cs +150 -0
- package/ActorManager.cs.meta +11 -0
- package/ActorOrganizer.cs +94 -0
- package/ActorOrganizer.cs.meta +11 -0
- package/BasicExpressionChanger.cs +158 -0
- package/BasicExpressionChanger.cs.meta +11 -0
- package/BasicLayerHandler.cs +109 -0
- package/BasicLayerHandler.cs.meta +11 -0
- package/DREditor.Actors.asmdef +21 -0
- package/DREditor.Actors.asmdef.meta +7 -0
- package/Editor/AssignmentStyleGUIEditor.cs +172 -0
- package/Editor/AssignmentStyleGUIEditor.cs.meta +2 -0
- package/Editor/AutoCreateCharacterWizard.cs +476 -0
- package/Editor/AutoCreateCharacterWizard.cs.meta +11 -0
- package/Editor/AutoCreateTrialCharacterWizard.cs +427 -0
- package/Editor/AutoCreateTrialCharacterWizard.cs.meta +2 -0
- package/Editor/CharacterUtility.cs +119 -0
- package/Editor/CharacterUtility.cs.meta +11 -0
- package/Editor/CircleDrawer.cs +207 -0
- package/Editor/CircleDrawer.cs.meta +2 -0
- package/Editor/CircleUtility.cs +55 -0
- package/Editor/CircleUtility.cs.meta +2 -0
- package/Editor/DREditor.Actors.Editor.asmdef +22 -0
- package/Editor/DREditor.Actors.Editor.asmdef.meta +7 -0
- package/Editor/GenerateCharacterIntroDialogues.cs +235 -0
- package/Editor/GenerateCharacterIntroDialogues.cs.meta +11 -0
- package/Editor/IItemImporter.cs +20 -0
- package/Editor/IItemImporter.cs.meta +2 -0
- package/Editor/ItemImporter.cs +171 -0
- package/Editor/ItemImporter.cs.meta +2 -0
- package/Editor/ItemUtility.cs +85 -0
- package/Editor/ItemUtility.cs.meta +11 -0
- package/Editor/ItemWizard.cs +42 -0
- package/Editor/ItemWizard.cs.meta +11 -0
- package/Editor.meta +8 -0
- package/Events/ActorCheckFocusEvent.cs +50 -0
- package/Events/ActorCheckFocusEvent.cs.meta +11 -0
- package/Events/ActorFadeEvent.cs +20 -0
- package/Events/ActorFadeEvent.cs.meta +11 -0
- package/Events/ActorFadeHandler.cs +54 -0
- package/Events/ActorFadeHandler.cs.meta +11 -0
- package/Events/ActorFaintEvent.cs +283 -0
- package/Events/ActorFaintEvent.cs.meta +11 -0
- package/Events/ActorFaintEventRenderQ.cs +66 -0
- package/Events/ActorFaintEventRenderQ.cs.meta +11 -0
- package/Events/ActorLeaveHandler.cs +239 -0
- package/Events/ActorLeaveHandler.cs.meta +11 -0
- package/Events/ActorSpriteFader.cs +191 -0
- package/Events/ActorSpriteFader.cs.meta +11 -0
- package/Events/ActorSpriteFaderRenderQ.cs +50 -0
- package/Events/ActorSpriteFaderRenderQ.cs.meta +11 -0
- package/Events/BSTrialActorFlash.cs +260 -0
- package/Events/BSTrialActorFlash.cs.meta +11 -0
- package/Events/ChangeLastFocusEvent.cs +63 -0
- package/Events/ChangeLastFocusEvent.cs.meta +11 -0
- package/Events/MoveCharacterEvent.cs +142 -0
- package/Events/MoveCharacterEvent.cs.meta +11 -0
- package/Events.meta +8 -0
- package/ExpressionChanger.cs +26 -0
- package/ExpressionChanger.cs.meta +11 -0
- package/FocusHandler.cs +97 -0
- package/FocusHandler.cs.meta +11 -0
- package/Implementation/ActorFocusHandler.cs +196 -0
- package/Implementation/ActorFocusHandler.cs.meta +11 -0
- package/Implementation/ActorFocusLoadEnd.cs +109 -0
- package/Implementation/ActorFocusLoadEnd.cs.meta +11 -0
- package/Implementation/ActorFocusPrepare.cs +103 -0
- package/Implementation/ActorFocusPrepare.cs.meta +11 -0
- package/Implementation/ActorFocusResolve.cs +68 -0
- package/Implementation/ActorFocusResolve.cs.meta +11 -0
- package/Implementation/ActorSpriteChanger.cs +130 -0
- package/Implementation/ActorSpriteChanger.cs.meta +11 -0
- package/Implementation/ActorTrialSpriteChanger.cs +47 -0
- package/Implementation/ActorTrialSpriteChanger.cs.meta +11 -0
- package/Implementation/ChangeLastSpriteEvent.cs +93 -0
- package/Implementation/ChangeLastSpriteEvent.cs.meta +11 -0
- package/Implementation/WorldSpriteChanger.cs +208 -0
- package/Implementation/WorldSpriteChanger.cs.meta +11 -0
- package/Implementation.meta +8 -0
- package/LayerHandler.cs +31 -0
- package/LayerHandler.cs.meta +11 -0
- package/Samples/Actor.prefab +581 -0
- package/Samples/Actor.prefab.meta +7 -0
- package/Samples/Actor_Body_Debugger.prefab +68 -0
- package/Samples/Actor_Body_Debugger.prefab.meta +7 -0
- package/Samples/Actor_Check_Focus_Event.prefab +47 -0
- package/Samples/Actor_Check_Focus_Event.prefab.meta +7 -0
- package/Samples/Actor_Event_Handlers.prefab +668 -0
- package/Samples/Actor_Event_Handlers.prefab.meta +7 -0
- package/Samples/Actor_Fade_Handler.prefab +137 -0
- package/Samples/Actor_Fade_Handler.prefab.meta +7 -0
- package/Samples/Actor_Fade_Handler_Render_Q.prefab +137 -0
- package/Samples/Actor_Fade_Handler_Render_Q.prefab.meta +7 -0
- package/Samples/Actor_Faint_Event.prefab +71 -0
- package/Samples/Actor_Faint_Event.prefab.meta +7 -0
- package/Samples/Actor_Faint_Event_Render_Q.prefab +73 -0
- package/Samples/Actor_Faint_Event_Render_Q.prefab.meta +7 -0
- package/Samples/Actor_Focus_Handler.prefab +168 -0
- package/Samples/Actor_Focus_Handler.prefab.meta +7 -0
- package/Samples/Actor_Focus_Handler_Shell.prefab +56 -0
- package/Samples/Actor_Focus_Handler_Shell.prefab.meta +7 -0
- package/Samples/Actor_Focus_Load_End.prefab +66 -0
- package/Samples/Actor_Focus_Load_End.prefab.meta +7 -0
- package/Samples/Actor_Focus_Prepare.prefab +49 -0
- package/Samples/Actor_Focus_Prepare.prefab.meta +7 -0
- package/Samples/Actor_Focus_Resolve.prefab +48 -0
- package/Samples/Actor_Focus_Resolve.prefab.meta +7 -0
- package/Samples/Actor_Leave_Handler.prefab +141 -0
- package/Samples/Actor_Leave_Handler.prefab.meta +7 -0
- package/Samples/Actor_Leave_Handler_Render_Q.prefab +141 -0
- package/Samples/Actor_Leave_Handler_Render_Q.prefab.meta +7 -0
- package/Samples/Actor_Organizer.prefab +49 -0
- package/Samples/Actor_Organizer.prefab.meta +7 -0
- package/Samples/Actor_Sprite_Changer.prefab +163 -0
- package/Samples/Actor_Sprite_Changer.prefab.meta +7 -0
- package/Samples/Actor_Sprite_Changer_Shell.prefab +51 -0
- package/Samples/Actor_Sprite_Changer_Shell.prefab.meta +7 -0
- package/Samples/Actor_Sprite_Fader.prefab +52 -0
- package/Samples/Actor_Sprite_Fader.prefab.meta +7 -0
- package/Samples/Actor_Sprite_Fader_Render_Q.prefab +54 -0
- package/Samples/Actor_Sprite_Fader_Render_Q.prefab.meta +7 -0
- package/Samples/Actor_Trial_Sprite_Changer.prefab +47 -0
- package/Samples/Actor_Trial_Sprite_Changer.prefab.meta +7 -0
- package/Samples/Change_Last_Focus_Event.prefab +66 -0
- package/Samples/Change_Last_Focus_Event.prefab.meta +7 -0
- package/Samples/Change_Last_Sprite_Event.prefab +49 -0
- package/Samples/Change_Last_Sprite_Event.prefab.meta +7 -0
- package/Samples/Change_Last_World_Sprite_Event.prefab +186 -0
- package/Samples/Change_Last_World_Sprite_Event.prefab.meta +7 -0
- package/Samples/Focus_Handler.prefab +49 -0
- package/Samples/Focus_Handler.prefab.meta +7 -0
- package/Samples/Move_Character_Event.prefab +51 -0
- package/Samples/Move_Character_Event.prefab.meta +7 -0
- package/Samples/World_Sprite_Changer.prefab +51 -0
- package/Samples/World_Sprite_Changer.prefab.meta +7 -0
- package/Samples.meta +8 -0
- package/package.json +38 -6
- package/package.json.meta +7 -0
- package/README.md +0 -3
package/Actor.cs
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.LocalDialogues;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using DREditor.Talkables;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Actors
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader(nameof(Talkable) +
|
|
13
|
+
"\n\n")]
|
|
14
|
+
public class Actor : Talkable
|
|
15
|
+
{
|
|
16
|
+
/// <inheritdoc/>
|
|
17
|
+
protected override void Start()
|
|
18
|
+
{
|
|
19
|
+
base.Start();
|
|
20
|
+
|
|
21
|
+
if (LocalDialogueHandlerBase.BookOfTriggers.ContainsKey(gameObject.name))
|
|
22
|
+
LocalDialogueHandlerBase.BookOfTriggers.Remove(gameObject.name);
|
|
23
|
+
|
|
24
|
+
LocalDialogueHandlerBase.BookOfTriggers.Add(gameObject.name, this);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// <inheritdoc/>
|
|
28
|
+
protected override void OnDestroy()
|
|
29
|
+
{
|
|
30
|
+
LocalDialogueHandlerBase.BookOfTriggers.Remove(gameObject.name);
|
|
31
|
+
|
|
32
|
+
base.OnDestroy();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// <inheritdoc/>
|
|
36
|
+
public override void SelectObject()
|
|
37
|
+
{
|
|
38
|
+
Dialogue[] conversation = new Dialogue[1];
|
|
39
|
+
|
|
40
|
+
conversation[0] = ServiceLocator.GetService<LocalDialogueHandlerBase>().EvaluateDialogue(conversations);
|
|
41
|
+
|
|
42
|
+
if (conversation[0] != null && conversation[0].ContainsCharacterNamed(gameObject.name) && !identified)
|
|
43
|
+
identified = true;
|
|
44
|
+
|
|
45
|
+
InvokeConversation(conversation);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// <inheritdoc/>
|
|
49
|
+
public override void SkipConversation(int conversationIndex)
|
|
50
|
+
{
|
|
51
|
+
base.SkipConversation(conversationIndex);
|
|
52
|
+
|
|
53
|
+
if (!identified)
|
|
54
|
+
identified = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// <inheritdoc/>
|
|
58
|
+
public override string DisplayName
|
|
59
|
+
{
|
|
60
|
+
get => base.DisplayName;
|
|
61
|
+
|
|
62
|
+
set
|
|
63
|
+
{
|
|
64
|
+
if (displayName == unidentifiedDisplayName)
|
|
65
|
+
return;
|
|
66
|
+
else
|
|
67
|
+
base.DisplayName = value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public virtual void SetIdentified(bool identified) => this.identified = identified;
|
|
72
|
+
|
|
73
|
+
public virtual bool GetIdentified() => identified;
|
|
74
|
+
}
|
|
75
|
+
}
|
package/Actor.cs.meta
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.Events;
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using UnityEngine.InputSystem;
|
|
7
|
+
using static UnityEngine.InputSystem.InputAction;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Actors
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
[ClassHeader("")]
|
|
15
|
+
[AddComponentMenu("DREditor/Actors/DREditor/Actor Body Debugger")]
|
|
16
|
+
public class ActorBodyDebugger : ServiceHolder<ActorBodyDebugger>
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Header("")]
|
|
22
|
+
[Divider]
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected bool debugBody = false;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Header("")]
|
|
31
|
+
[Divider]
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected bool useKeyBind = false;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
[Tooltip("")]
|
|
39
|
+
[SerializeField] protected InputAction action = null;
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
[Tooltip("")]
|
|
45
|
+
[SerializeField] protected SelectableObjectWithEvent currentActor = null;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
[Tooltip("")]
|
|
51
|
+
[SerializeField] protected SelectableObjectWithEvent lastActor = null;
|
|
52
|
+
|
|
53
|
+
/// <summary>
|
|
54
|
+
///
|
|
55
|
+
/// </summary>
|
|
56
|
+
[Tooltip("")]
|
|
57
|
+
[SerializeField] protected string setCameraPositionEventString = "SetDialogueCameraPosition";
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
protected virtual void OnEnable()
|
|
64
|
+
{
|
|
65
|
+
if (useKeyBind)
|
|
66
|
+
{
|
|
67
|
+
action.started += ToggleDebugBody;
|
|
68
|
+
|
|
69
|
+
action.Enable();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
///
|
|
75
|
+
/// </summary>
|
|
76
|
+
protected virtual void OnDisable()
|
|
77
|
+
{
|
|
78
|
+
if (useKeyBind)
|
|
79
|
+
{
|
|
80
|
+
action.started -= ToggleDebugBody;
|
|
81
|
+
|
|
82
|
+
action.Disable();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
///
|
|
88
|
+
/// </summary>
|
|
89
|
+
/// <param name="ctx"></param>
|
|
90
|
+
protected virtual void ToggleDebugBody(CallbackContext ctx) => debugBody = !debugBody;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/// <summary>
|
|
94
|
+
///
|
|
95
|
+
/// </summary>
|
|
96
|
+
protected virtual void Update() => CheckDebugBody();
|
|
97
|
+
|
|
98
|
+
/// <summary>
|
|
99
|
+
///
|
|
100
|
+
/// </summary>
|
|
101
|
+
protected virtual void CheckDebugBody()
|
|
102
|
+
{
|
|
103
|
+
if (debugBody)
|
|
104
|
+
MoveDialogueCameraToBodyPosition();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/// <summary>
|
|
108
|
+
///
|
|
109
|
+
/// </summary>
|
|
110
|
+
protected virtual void MoveDialogueCameraToBodyPosition()
|
|
111
|
+
{
|
|
112
|
+
if (currentActor.Value != null)
|
|
113
|
+
DialogueEventSystem.TriggerEvent(setCameraPositionEventString, ((Actor)currentActor.Value).body.position, false);
|
|
114
|
+
else if (lastActor.Value != null)
|
|
115
|
+
DialogueEventSystem.TriggerEvent(setCameraPositionEventString, ((Actor)lastActor.Value).body.position, false);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: e629d5b16ad475c4db055e67990014b3
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences:
|
|
7
|
+
- currentActor: {fileID: 11400000, guid: 29593b990b9456846bf35e9933e0bd80, type: 2}
|
|
8
|
+
- lastActor: {fileID: 11400000, guid: 6466f838a3a6bd848b31cde792bef69c, type: 2}
|
|
9
|
+
executionOrder: 0
|
|
10
|
+
icon: {instanceID: 0}
|
|
11
|
+
userData:
|
|
12
|
+
assetBundleName:
|
|
13
|
+
assetBundleVariant:
|
package/ActorManager.cs
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Services;
|
|
4
|
+
using DREditor.Talkables;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Actors
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
[ClassHeader(nameof(DialogueObjectManager) + ", " + nameof(IObjectPooler<Talkable>) +
|
|
15
|
+
"\n\n")]
|
|
16
|
+
public class ActorManager : DialogueObjectManager, IObjectPooler<Talkable>
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected string tutorialCharacterFirstName = "Tutorial";
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected bool logActorsNotFound = false;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
[Header("")]
|
|
35
|
+
[Divider]
|
|
36
|
+
[Tooltip("")]
|
|
37
|
+
[SerializeField] protected List<Talkable> actors = new();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
protected IDialogueManager dialogueManager = null;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
protected virtual void OnEnable()
|
|
50
|
+
{
|
|
51
|
+
if (gameObject != null)
|
|
52
|
+
{
|
|
53
|
+
RegisterService<DialogueObjectManager>(this);
|
|
54
|
+
|
|
55
|
+
RegisterService<IObjectPooler<Talkable>>(this);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
dialogueManager = ServiceLocator.GetService<IDialogueManager>();
|
|
59
|
+
|
|
60
|
+
if (dialogueManager != null)
|
|
61
|
+
dialogueManager.GetEnder().OnDialogueResolving += SetStartObjectNull;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
///
|
|
66
|
+
/// </summary>
|
|
67
|
+
/// <typeparam name="T"></typeparam>
|
|
68
|
+
/// <param name="service"></param>
|
|
69
|
+
protected virtual void RegisterService<T>(T service) where T : class
|
|
70
|
+
{
|
|
71
|
+
if (!ServiceLocator.HasService<T>())
|
|
72
|
+
ServiceLocator.Register(service);
|
|
73
|
+
else
|
|
74
|
+
Destroy(gameObject);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/// <summary>
|
|
79
|
+
///
|
|
80
|
+
/// </summary>
|
|
81
|
+
protected virtual void OnDisable()
|
|
82
|
+
{
|
|
83
|
+
if (dialogueManager != null)
|
|
84
|
+
dialogueManager.GetEnder().OnDialogueResolving -= SetStartObjectNull;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/// <inheritdoc/>
|
|
89
|
+
public virtual void RegisterObject(Talkable obj)
|
|
90
|
+
{
|
|
91
|
+
if (obj is Talkable talkable)
|
|
92
|
+
{
|
|
93
|
+
if (actors.Contains(talkable))
|
|
94
|
+
return;
|
|
95
|
+
|
|
96
|
+
actors.Add(talkable);
|
|
97
|
+
|
|
98
|
+
talkable.SubscribeToStartConversation(Evaluate);
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
UnityEngine.Debug.LogWarning("Object Tried To register to a Pooler that doesn't use it's type");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// <inheritdoc/>
|
|
105
|
+
public virtual void UnregisterObject(Talkable obj)
|
|
106
|
+
{
|
|
107
|
+
actors.Remove(obj);
|
|
108
|
+
|
|
109
|
+
obj.UnsubscribeToStartConversation(Evaluate);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
///
|
|
114
|
+
/// </summary>
|
|
115
|
+
/// <param name="talkable"></param>
|
|
116
|
+
/// <param name="Conversation"></param>
|
|
117
|
+
protected virtual void Evaluate(Talkable talkable, Dialogue[] Conversation)
|
|
118
|
+
{
|
|
119
|
+
startObject = talkable;
|
|
120
|
+
|
|
121
|
+
if (ServiceLocator.HasService<IDialogueManager>())
|
|
122
|
+
{
|
|
123
|
+
if (Conversation[0] != null)
|
|
124
|
+
ServiceLocator.GetService<IDialogueManager>().StartDialogue(talkable, Conversation);
|
|
125
|
+
else
|
|
126
|
+
ServiceLocator.GetService<IDialogueManager>().DebugNoCharacterDialogueCall(talkable);
|
|
127
|
+
}
|
|
128
|
+
else
|
|
129
|
+
UnityEngine.Debug.LogWarning($"ALERT: {ToString()}: ActorManager could not get {nameof(IDialogueManager)}!");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/// <inheritdoc/>
|
|
134
|
+
public virtual Talkable GetObjectByName(string name)
|
|
135
|
+
{
|
|
136
|
+
var actors = GetRegisteredObjects().OfType<Talkable>()
|
|
137
|
+
.Where(talkable => talkable.gameObject.name == name);
|
|
138
|
+
|
|
139
|
+
if (actors.Any())
|
|
140
|
+
return actors.First();
|
|
141
|
+
else if (name != tutorialCharacterFirstName && logActorsNotFound)
|
|
142
|
+
UnityEngine.Debug.Log($"REPORT: {ToString()}: Couldn't find actor: {name}.");
|
|
143
|
+
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/// <inheritdoc/>
|
|
148
|
+
public virtual List<Talkable> GetRegisteredObjects() => actors;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Dialogues.LineReading;
|
|
4
|
+
using DREditor.Dialogues.Loading;
|
|
5
|
+
using DREditor.EventObjects;
|
|
6
|
+
using DREditor.Services;
|
|
7
|
+
using DREditor.Talkables;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Actors
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[ClassHeader("" + nameof(ILineProcessor) + ", " + nameof(ILineEndProcess) + ", " +
|
|
16
|
+
nameof(ILoadToLineable) + ", " + nameof(ILoadToLineEnd) + ", " + nameof(IDialogueReaderCleanUp) + ", " +
|
|
17
|
+
nameof(IToTitleScreen) +
|
|
18
|
+
"\n\n")]
|
|
19
|
+
public class ActorOrganizer : DialogueComponent, ILineProcessor, ILineEndProcess,
|
|
20
|
+
ILoadToLineable, ILoadToLineEnd, IDialogueReaderCleanUp, IToTitleScreen
|
|
21
|
+
{
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Header("")]
|
|
26
|
+
[Divider]
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected BoolWithEvent isProtagSpeaking = null;
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Tooltip("")]
|
|
34
|
+
[SerializeField] protected SelectableObjectWithEvent currentActor = null;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
[Tooltip("")]
|
|
40
|
+
[SerializeField] protected SelectableObjectWithEvent lastActor = null;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <param name="name"></param>
|
|
47
|
+
protected virtual void SetCurrentActorByName(string name)
|
|
48
|
+
{
|
|
49
|
+
currentActor.SetValue((Actor)ServiceLocator.GetService<IObjectPooler<Talkable>>().GetObjectByName(name));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <param name="currentLine"></param>
|
|
56
|
+
protected virtual void SetLastActorFromLineData(Line currentLine = null)
|
|
57
|
+
{
|
|
58
|
+
if (!isProtagSpeaking.Value && !currentLine.DontPan)
|
|
59
|
+
lastActor.SetValue((Actor)currentActor.Value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/// <inheritdoc/>
|
|
64
|
+
public virtual void LineProcess(Line currentLine)
|
|
65
|
+
{
|
|
66
|
+
if (currentLine.Speaker != null && !isProtagSpeaking.Value)
|
|
67
|
+
SetCurrentActorByName(currentLine.Speaker.FirstName);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// <inheritdoc/>
|
|
71
|
+
public virtual void LineEndProcess(Line currentLine = null) => SetLastActorFromLineData(currentLine);
|
|
72
|
+
|
|
73
|
+
/// <inheritdoc/>
|
|
74
|
+
public virtual void OnLoadToLine(Line currentLine)
|
|
75
|
+
{
|
|
76
|
+
if (currentLine.Speaker != null)
|
|
77
|
+
SetCurrentActorByName(currentLine.Speaker.FirstName);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// <inheritdoc/>
|
|
81
|
+
public virtual void OnLoadToLineEnd(Line currentLine) => SetLastActorFromLineData(currentLine);
|
|
82
|
+
|
|
83
|
+
/// <inheritdoc/>
|
|
84
|
+
public virtual void OnDialogueReaderCleanUp()
|
|
85
|
+
{
|
|
86
|
+
lastActor.SetValue(null);
|
|
87
|
+
|
|
88
|
+
ToTitleScreen();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/// <inheritdoc/>
|
|
92
|
+
public virtual void ToTitleScreen() => isProtagSpeaking.SetValue(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
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.EventObjects;
|
|
6
|
+
using System.Collections;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace DREditor.Actors
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
///
|
|
13
|
+
/// </summary>
|
|
14
|
+
/// <remarks>
|
|
15
|
+
///
|
|
16
|
+
/// </remarks>
|
|
17
|
+
[ClassHeader(nameof(ExpressionChanger) +
|
|
18
|
+
"\n\n")]
|
|
19
|
+
public class BasicExpressionChanger : ExpressionChanger
|
|
20
|
+
{
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected BoolWithEvent isLoadingFile = null;
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected BoolWithEvent spriteIsFading = null;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
[Header("")]
|
|
38
|
+
[Divider]
|
|
39
|
+
[Tooltip("")]
|
|
40
|
+
[SerializeField] protected MeshRenderer character = null;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
[Tooltip("")]
|
|
46
|
+
[SerializeField] protected MeshRenderer characterb = null;
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
///
|
|
50
|
+
/// </summary>
|
|
51
|
+
[Tooltip("")]
|
|
52
|
+
[SerializeField] protected SpriteRenderer sprite = null;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
[Tooltip("")]
|
|
58
|
+
[SerializeField] protected SpriteRenderer spriteb = null;
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
///
|
|
63
|
+
/// </summary>
|
|
64
|
+
[Header("")]
|
|
65
|
+
[Divider]
|
|
66
|
+
[Tooltip("")]
|
|
67
|
+
[SerializeField] protected float spriteChangeTime = 0.185f;
|
|
68
|
+
|
|
69
|
+
/// <summary>
|
|
70
|
+
///
|
|
71
|
+
/// </summary>
|
|
72
|
+
[Tooltip("")]
|
|
73
|
+
[SerializeField] protected float finishedWorldSpriteChangeBufferTime = 0;
|
|
74
|
+
#if DOTWEEN
|
|
75
|
+
/// <summary>
|
|
76
|
+
///
|
|
77
|
+
/// </summary>
|
|
78
|
+
[Tooltip("")]
|
|
79
|
+
[SerializeField] protected Ease bottomSpriteFadeInCurve = Ease.Linear;
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
///
|
|
83
|
+
/// </summary>
|
|
84
|
+
[Tooltip("")]
|
|
85
|
+
[SerializeField] protected Ease topSpriteFadeOutCurve = Ease.Linear;
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
/// <inheritdoc/>
|
|
89
|
+
public override void FastForwardExpressionChange(Material expressionMaterial, Sprite expressionSprite)
|
|
90
|
+
{
|
|
91
|
+
if (spriteIsFading.Value)
|
|
92
|
+
{
|
|
93
|
+
#if DOTWEEN
|
|
94
|
+
sprite.DOKill();
|
|
95
|
+
#endif
|
|
96
|
+
sprite.color = new Color(255, 255, 255, 255);
|
|
97
|
+
/* The above line causes a visual kinda bug where pressing fast forward, a sprite changes, then
|
|
98
|
+
* going out of fast forward, will incorrectly fade the sprite transition. But this line seems
|
|
99
|
+
* needed for fixing the bug of CharLeave overpowering sprite change.
|
|
100
|
+
*/
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
SetActorMaterials(expressionMaterial);
|
|
104
|
+
|
|
105
|
+
sprite.sprite = expressionSprite;
|
|
106
|
+
|
|
107
|
+
spriteb.sprite = expressionSprite;
|
|
108
|
+
|
|
109
|
+
if (!isLoadingFile.Value)
|
|
110
|
+
MoveSpriteToFront();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/// <inheritdoc/>
|
|
114
|
+
public override IEnumerator ChangeExpressionProcess(Material expressionMaterial, Sprite expressionSprite)
|
|
115
|
+
{
|
|
116
|
+
SetActorMaterials(expressionMaterial);
|
|
117
|
+
|
|
118
|
+
spriteb.sprite = expressionSprite;
|
|
119
|
+
#if DOTWEEN
|
|
120
|
+
spriteb.DOFade(1, spriteChangeTime).SetEase(bottomSpriteFadeInCurve);
|
|
121
|
+
|
|
122
|
+
sprite.DOFade(0, spriteChangeTime).SetEase(topSpriteFadeOutCurve);
|
|
123
|
+
#endif
|
|
124
|
+
yield return new WaitForSeconds(spriteChangeTime);
|
|
125
|
+
|
|
126
|
+
sprite.sprite = expressionSprite;
|
|
127
|
+
|
|
128
|
+
MoveSpriteToFront();
|
|
129
|
+
|
|
130
|
+
if (finishedWorldSpriteChangeBufferTime > 0)
|
|
131
|
+
yield return new WaitForSeconds(finishedWorldSpriteChangeBufferTime);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/// <summary>
|
|
136
|
+
///
|
|
137
|
+
/// </summary>
|
|
138
|
+
/// <param name="material"></param>
|
|
139
|
+
protected virtual void SetActorMaterials(Material material)
|
|
140
|
+
{
|
|
141
|
+
character.material = material;
|
|
142
|
+
|
|
143
|
+
characterb.material.mainTexture = character.material.mainTexture;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// <summary>
|
|
147
|
+
///
|
|
148
|
+
/// </summary>
|
|
149
|
+
protected virtual void MoveSpriteToFront()
|
|
150
|
+
{
|
|
151
|
+
#if DOTWEEN
|
|
152
|
+
sprite.DOFade(1, 0);
|
|
153
|
+
|
|
154
|
+
spriteb.DOFade(0, 0);
|
|
155
|
+
#endif
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|