net.dreditor.minigames 0.1.6 → 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/BulletDifficulty.cs +36 -36
- package/BulletDifficulty.cs.meta +11 -11
- package/BulletDifficultyEditor.cs +380 -380
- package/BulletDifficultyEditor.cs.meta +11 -11
- package/DREditor.Minigames.asmdef +36 -36
- package/DREditor.Minigames.asmdef.meta +7 -7
- package/DifficultyEditorBase.cs +60 -60
- package/DifficultyEditorBase.cs.meta +11 -11
- package/IShatterGraphic.cs +32 -32
- package/IShatterGraphic.cs.meta +11 -11
- package/IShatterText.cs +33 -33
- package/IShatterText.cs.meta +11 -11
- package/InitializeTrialOffsets.cs +51 -51
- package/InitializeTrialOffsets.cs.meta +11 -11
- package/MinigameBuilderBase.cs +28 -28
- package/MinigameBuilderBase.cs.meta +11 -11
- package/MinigameControlsUIHandler.cs +94 -94
- package/MinigameControlsUIHandler.cs.meta +11 -11
- package/MinigameManagerBase.cs +197 -197
- package/MinigameManagerBase.cs.meta +11 -11
- package/QuestionToggle.cs +154 -154
- package/QuestionToggle.cs.meta +11 -11
- package/RestoreControlsUIPostDialogue.cs +100 -100
- package/RestoreControlsUIPostDialogue.cs.meta +1 -1
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset +23 -23
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset.meta +8 -8
- package/{Samples → Samples~}/HasStamina.asset +21 -21
- package/{Samples → Samples~}/HasStamina.asset.meta +8 -8
- package/{Samples → Samples~}/IsDrainingStamina.asset +21 -21
- package/{Samples → Samples~}/IsDrainingStamina.asset.meta +8 -8
- package/{Samples → Samples~}/MinigameInputAllowed.asset +21 -21
- package/{Samples → Samples~}/MinigameInputAllowed.asset.meta +8 -8
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab +53 -53
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Quad Shatter.asset +31 -31
- package/{Samples → Samples~}/Quad Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/ShatterCameraEnabled.asset +21 -21
- package/{Samples → Samples~}/ShatterCameraEnabled.asset.meta +8 -8
- package/{Samples → Samples~}/Shatter_Graphic.prefab +98 -98
- package/{Samples → Samples~}/Shatter_Graphic.prefab.meta +7 -7
- package/{Samples → Samples~}/Stamina_Handler.prefab +59 -59
- package/{Samples → Samples~}/Stamina_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab +60 -60
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Template.prefab +504 -504
- package/{Samples → Samples~}/TBS_Manager_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab +289 -289
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab +449 -449
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Triangle Shatter.asset +31 -31
- package/{Samples → Samples~}/Triangle Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab +221 -221
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab +525 -525
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab +38 -38
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab +1159 -1159
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab +494 -494
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab +294 -294
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab.meta +7 -7
- package/Shattering/BreakTex.renderTexture +39 -39
- package/Shattering/BreakTex.renderTexture.meta +8 -8
- package/Shattering/BulletShatter.cs +176 -176
- package/Shattering/BulletShatter.cs.meta +11 -11
- package/Shattering/IShatterableCanvas.cs +20 -20
- package/Shattering/IShatterableCanvas.cs.meta +11 -11
- package/Shattering/MeshGenerator.cs +178 -178
- package/Shattering/MeshGenerator.cs.meta +11 -11
- package/Shattering/RenderCanvasOnShatter.cs +47 -47
- package/Shattering/RenderCanvasOnShatter.cs.meta +11 -11
- package/Shattering/ShatterCameraRender.cs +79 -79
- package/Shattering/ShatterCameraRender.cs.meta +11 -11
- package/Shattering/ShatterGraphic.cs +135 -135
- package/Shattering/ShatterGraphic.cs.meta +11 -11
- package/Shattering/ShatterMeshGraphic.cs +304 -304
- package/Shattering/ShatterMeshGraphic.cs.meta +11 -11
- package/Shattering/ShatterProcess.cs +282 -282
- package/Shattering/ShatterProcess.cs.meta +11 -11
- package/Shattering/ShatterProcessBase.cs +51 -51
- package/Shattering/ShatterProcessBase.cs.meta +11 -11
- package/Shattering/ShatterQuad.cs +56 -56
- package/Shattering/ShatterQuad.cs.meta +11 -11
- package/Shattering/ShatterQuadProcess.cs +65 -65
- package/Shattering/ShatterQuadProcess.cs.meta +11 -11
- package/Shattering/ShatterShape.cs +84 -84
- package/Shattering/ShatterShape.cs.meta +11 -11
- package/Shattering/ShatterTri.cs +27 -27
- package/Shattering/ShatterTri.cs.meta +11 -11
- package/Shattering/ShatterTriProcess.cs +179 -179
- package/Shattering/ShatterTriProcess.cs.meta +11 -11
- package/Shattering/ShatterWithUI.cs +68 -68
- package/Shattering/ShatterWithUI.cs.meta +11 -11
- package/Shattering/SplitShatter.cs +114 -114
- package/Shattering/SplitShatter.cs.meta +11 -11
- package/Shattering/TMPTextShatter.cs +243 -243
- package/Shattering/TMPTextShatter.cs.meta +11 -11
- package/Shattering/UIBreakVisibility.cs +172 -172
- package/Shattering/UIBreakVisibility.cs.meta +11 -11
- package/Shattering.meta +8 -8
- package/ShuffleUtility.cs +32 -32
- package/ShuffleUtility.cs.meta +11 -11
- package/SimpleRandom.cs +32 -32
- package/SimpleRandom.cs.meta +11 -11
- package/Stats/ColorHealthBar.cs +56 -56
- package/Stats/ColorHealthBar.cs.meta +11 -11
- package/Stats/ColorHealthModifier.cs +138 -138
- package/Stats/ColorHealthModifier.cs.meta +11 -11
- package/Stats/GaugeHandler.cs +72 -72
- package/Stats/GaugeHandler.cs.meta +1 -1
- package/Stats/HealthBarModifier.cs +89 -89
- package/Stats/HealthBarModifier.cs.meta +11 -11
- package/Stats/HealthStat.cs +77 -77
- package/Stats/HealthStat.cs.meta +11 -11
- package/Stats/HealthStatBase.cs +26 -26
- package/Stats/HealthStatBase.cs.meta +11 -11
- package/Stats/IGauge.cs +36 -36
- package/Stats/IGauge.cs.meta +1 -1
- package/Stats/InfluenceGauge.cs +107 -107
- package/Stats/InfluenceGauge.cs.meta +11 -11
- package/Stats/InfluenceGaugeBase.cs +42 -42
- package/Stats/InfluenceGaugeBase.cs.meta +11 -11
- package/Stats/SimpleGauge.cs +46 -46
- package/Stats/SimpleGauge.cs.meta +1 -1
- package/Stats/StaminaHandler.cs +153 -153
- package/Stats/StaminaHandler.cs.meta +11 -11
- package/Stats/TrialStats.cs +140 -140
- package/Stats/TrialStats.cs.meta +11 -11
- package/Stats/TrialStatsBase.cs +36 -36
- package/Stats/TrialStatsBase.cs.meta +11 -11
- package/Stats.meta +8 -8
- package/TBS/TBSelectBuilder.cs +59 -59
- package/TBS/TBSelectBuilder.cs.meta +11 -11
- package/TBS/TBSelectBuilderEditor.cs +166 -166
- package/TBS/TBSelectBuilderEditor.cs.meta +11 -11
- package/TBS/TBSelectManager.cs +315 -315
- package/TBS/TBSelectManager.cs.meta +11 -11
- package/TBS/TBSelection.cs +46 -46
- package/TBS/TBSelection.cs.meta +11 -11
- package/TBS/TrialTruthBulletMenu.cs +24 -24
- package/TBS/TrialTruthBulletMenu.cs.meta +11 -11
- package/TBS.meta +8 -8
- package/ThreadSafeSimpleRandom.cs +29 -29
- package/ThreadSafeSimpleRandom.cs.meta +11 -11
- package/TimedDifficultyEditor.cs +56 -56
- package/TimedDifficultyEditor.cs.meta +11 -11
- package/TimedMinigameEditor.cs +31 -31
- package/TimedMinigameEditor.cs.meta +11 -11
- package/TimerBase.cs +189 -189
- package/TimerBase.cs.meta +11 -11
- package/TimerDifficulty.cs +45 -45
- package/TimerDifficulty.cs.meta +11 -11
- package/TrialDialogueMinigame.cs +276 -276
- package/TrialDialogueMinigame.cs.meta +11 -11
- package/TrialDiscussion.cs +68 -68
- package/TrialDiscussion.cs.meta +11 -11
- package/TrialTimer.cs +113 -113
- package/TrialTimer.cs.meta +11 -11
- package/TrialTimerBase.cs +129 -129
- package/TrialTimerBase.cs.meta +11 -11
- package/package.json +56 -51
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,244 +1,244 @@
|
|
|
1
|
-
// Completely Reworked Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
// Original Author: LeoTheDev
|
|
3
|
-
using TMPro;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Minigames.Shattering
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[RequireComponent(typeof(TMP_Text))]
|
|
12
|
-
[ClassHeader(nameof(IShatterText) +
|
|
13
|
-
"\n\n")]
|
|
14
|
-
public class TMPTextShatter : MonoBehaviour, IShatterText
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
[Tooltip("")]
|
|
20
|
-
[SerializeField] protected ShatterProcessBase shatterProcess;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected ShatterProcessBase shatterInstance;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
protected bool started;
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
protected Mesh resetMesh;
|
|
38
|
-
|
|
39
|
-
/// <summary>
|
|
40
|
-
///
|
|
41
|
-
/// </summary>
|
|
42
|
-
protected TMP_Text Container => GetComponent<TMP_Text>();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/// <inheritdoc/>
|
|
46
|
-
public virtual void SetMesh()
|
|
47
|
-
{
|
|
48
|
-
resetMesh = new Mesh
|
|
49
|
-
{
|
|
50
|
-
vertices = Container.mesh.vertices,
|
|
51
|
-
triangles = Container.mesh.triangles,
|
|
52
|
-
uv = Container.mesh.uv,
|
|
53
|
-
normals = Container.mesh.normals,
|
|
54
|
-
colors = Container.mesh.colors,
|
|
55
|
-
tangents = Container.mesh.tangents
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/// <inheritdoc/>
|
|
60
|
-
public virtual void ResetMesh()
|
|
61
|
-
{
|
|
62
|
-
if (resetMesh == null)
|
|
63
|
-
return;
|
|
64
|
-
|
|
65
|
-
started = false;
|
|
66
|
-
|
|
67
|
-
StopAllCoroutines();
|
|
68
|
-
|
|
69
|
-
ResolveShatterInstance();
|
|
70
|
-
|
|
71
|
-
ResolveContainer();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/// <summary>
|
|
75
|
-
///
|
|
76
|
-
/// </summary>
|
|
77
|
-
protected virtual void ResolveContainer()
|
|
78
|
-
{
|
|
79
|
-
Container.mesh.triangles = resetMesh.triangles;
|
|
80
|
-
|
|
81
|
-
Container.mesh.vertices = resetMesh.vertices;
|
|
82
|
-
|
|
83
|
-
Container.mesh.uv = resetMesh.uv;
|
|
84
|
-
|
|
85
|
-
Container.mesh.normals = resetMesh.normals;
|
|
86
|
-
|
|
87
|
-
Container.mesh.colors = resetMesh.colors;
|
|
88
|
-
|
|
89
|
-
Container.mesh.tangents = resetMesh.tangents;
|
|
90
|
-
|
|
91
|
-
Container.UpdateGeometry(Container.mesh, 0);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/// <summary>
|
|
95
|
-
///
|
|
96
|
-
/// </summary>
|
|
97
|
-
protected virtual void ResolveShatterInstance()
|
|
98
|
-
{
|
|
99
|
-
if (shatterInstance != null)
|
|
100
|
-
{
|
|
101
|
-
shatterInstance.Unready();
|
|
102
|
-
|
|
103
|
-
Destroy(shatterInstance);
|
|
104
|
-
|
|
105
|
-
shatterInstance = null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/// <inheritdoc/>
|
|
111
|
-
public virtual void Shatter(Vector3 hitPoint)
|
|
112
|
-
{
|
|
113
|
-
if (started)
|
|
114
|
-
return;
|
|
115
|
-
|
|
116
|
-
Container.ForceMeshUpdate(); // Force mesh update to get valid data
|
|
117
|
-
|
|
118
|
-
if (shatterInstance != null)
|
|
119
|
-
Destroy(shatterInstance);
|
|
120
|
-
|
|
121
|
-
shatterInstance = Instantiate(shatterProcess);
|
|
122
|
-
|
|
123
|
-
shatterInstance.Shatter(this, hitPoint, Container.mesh);
|
|
124
|
-
|
|
125
|
-
started = true;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/// <inheritdoc/>
|
|
129
|
-
public virtual void OverrideProcess(ScriptableObject shatterProcess)
|
|
130
|
-
{
|
|
131
|
-
if (shatterProcess is ShatterProcessBase process)
|
|
132
|
-
this.shatterProcess = process;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
protected virtual void Update() => CheckShatter();
|
|
136
|
-
|
|
137
|
-
/// <summary>
|
|
138
|
-
///
|
|
139
|
-
/// </summary>
|
|
140
|
-
protected virtual void CheckShatter()
|
|
141
|
-
{
|
|
142
|
-
if (started)
|
|
143
|
-
{
|
|
144
|
-
started = false;
|
|
145
|
-
|
|
146
|
-
StartCoroutine(shatterInstance.UpdateShatter(UpdateShatterCallback));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/// <summary>
|
|
151
|
-
///
|
|
152
|
-
/// </summary>
|
|
153
|
-
/// <param name="newVertices"></param>
|
|
154
|
-
/// <param name="vertexColors"></param>
|
|
155
|
-
protected virtual void UpdateShatterCallback(Vector3[] newVertices, Color[] vertexColors)
|
|
156
|
-
{
|
|
157
|
-
Container.mesh.vertices = newVertices;
|
|
158
|
-
|
|
159
|
-
Container.mesh.colors = vertexColors;
|
|
160
|
-
|
|
161
|
-
Container.UpdateGeometry(Container.mesh, 0);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
protected virtual void OnDrawGizmos()
|
|
166
|
-
{
|
|
167
|
-
if (Application.isPlaying)
|
|
168
|
-
{
|
|
169
|
-
Gizmos.color = Color.yellow;
|
|
170
|
-
|
|
171
|
-
Gizmos.DrawWireMesh(Container.mesh, Container.transform.position);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
#region Moving Char by Char Anim Study
|
|
176
|
-
|
|
177
|
-
//void Cope(Vector3 v)
|
|
178
|
-
//{
|
|
179
|
-
// if (v == Vector3.zero)
|
|
180
|
-
// v = new(-5, -1, 0);
|
|
181
|
-
// StartCoroutine(CopeRoutine(v));
|
|
182
|
-
|
|
183
|
-
//}
|
|
184
|
-
//Vector3 L(Vector3 point, Vector3 offset, float t)
|
|
185
|
-
//{
|
|
186
|
-
// Debug.Log(Vector3.Lerp(point, point + offset, t));
|
|
187
|
-
|
|
188
|
-
// return Vector3.Lerp(point, point + offset, t);
|
|
189
|
-
|
|
190
|
-
//}
|
|
191
|
-
//IEnumerator CopeRoutine(Vector3 to, float duration = 1)
|
|
192
|
-
//{
|
|
193
|
-
|
|
194
|
-
// Vector3[] iniV = new Vector3[Container.mesh.vertices.Length];
|
|
195
|
-
// for (int i = 0; i < iniV.Length; i++)
|
|
196
|
-
// {
|
|
197
|
-
// iniV[i] = Container.mesh.vertices[i];
|
|
198
|
-
// }
|
|
199
|
-
// Vector3[] newV = new Vector3[Container.mesh.vertices.Length];
|
|
200
|
-
// for (int i = 0; i < iniV.Length; i++)
|
|
201
|
-
// {
|
|
202
|
-
// newV[i] = iniV[i];
|
|
203
|
-
// }
|
|
204
|
-
|
|
205
|
-
// for (int i = 0; i < Container.mesh.vertices.Length; i += 4) // 4 should be a letter
|
|
206
|
-
// {
|
|
207
|
-
// StartCoroutine(MoveLetter(i, iniV, newV, to, duration));
|
|
208
|
-
// yield return new WaitForSeconds(Time.deltaTime);
|
|
209
|
-
// }
|
|
210
|
-
|
|
211
|
-
// yield break;
|
|
212
|
-
//}
|
|
213
|
-
//IEnumerator MoveLetter(int ind, Vector3[] iniV, Vector3[] newV, Vector3 to, float duration = 1)
|
|
214
|
-
//{
|
|
215
|
-
// float counter = 0;
|
|
216
|
-
// while (counter <= duration || iniV[ind] != iniV[ind] + to)
|
|
217
|
-
// {
|
|
218
|
-
|
|
219
|
-
// //Vector3[] newV = new Vector3[Container.mesh.vertices.Length];
|
|
220
|
-
// for (int i = ind; i < ind + 4; i += 4) // 4 should be a letter
|
|
221
|
-
// {
|
|
222
|
-
|
|
223
|
-
// newV[i] = L(iniV[i], to, counter);
|
|
224
|
-
// newV[i + 1] = L(iniV[i + 1], to, counter);
|
|
225
|
-
// newV[i + 2] = L(iniV[i + 2], to, counter);
|
|
226
|
-
// newV[i + 3] = L(iniV[i + 3], to, counter);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// }
|
|
230
|
-
|
|
231
|
-
// Container.mesh.vertices = newV;
|
|
232
|
-
// Container.UpdateGeometry(Container.mesh, 0);
|
|
233
|
-
// if (counter >= duration)
|
|
234
|
-
// yield break;
|
|
235
|
-
|
|
236
|
-
// counter += Time.deltaTime;
|
|
237
|
-
// yield return null;
|
|
238
|
-
// }
|
|
239
|
-
// yield break;
|
|
240
|
-
//}
|
|
241
|
-
|
|
242
|
-
#endregion
|
|
243
|
-
}
|
|
1
|
+
// Completely Reworked Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
// Original Author: LeoTheDev
|
|
3
|
+
using TMPro;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Minigames.Shattering
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[RequireComponent(typeof(TMP_Text))]
|
|
12
|
+
[ClassHeader(nameof(IShatterText) +
|
|
13
|
+
"\n\n")]
|
|
14
|
+
public class TMPTextShatter : MonoBehaviour, IShatterText
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Tooltip("")]
|
|
20
|
+
[SerializeField] protected ShatterProcessBase shatterProcess;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected ShatterProcessBase shatterInstance;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
protected bool started;
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
protected Mesh resetMesh;
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
protected TMP_Text Container => GetComponent<TMP_Text>();
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/// <inheritdoc/>
|
|
46
|
+
public virtual void SetMesh()
|
|
47
|
+
{
|
|
48
|
+
resetMesh = new Mesh
|
|
49
|
+
{
|
|
50
|
+
vertices = Container.mesh.vertices,
|
|
51
|
+
triangles = Container.mesh.triangles,
|
|
52
|
+
uv = Container.mesh.uv,
|
|
53
|
+
normals = Container.mesh.normals,
|
|
54
|
+
colors = Container.mesh.colors,
|
|
55
|
+
tangents = Container.mesh.tangents
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <inheritdoc/>
|
|
60
|
+
public virtual void ResetMesh()
|
|
61
|
+
{
|
|
62
|
+
if (resetMesh == null)
|
|
63
|
+
return;
|
|
64
|
+
|
|
65
|
+
started = false;
|
|
66
|
+
|
|
67
|
+
StopAllCoroutines();
|
|
68
|
+
|
|
69
|
+
ResolveShatterInstance();
|
|
70
|
+
|
|
71
|
+
ResolveContainer();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
///
|
|
76
|
+
/// </summary>
|
|
77
|
+
protected virtual void ResolveContainer()
|
|
78
|
+
{
|
|
79
|
+
Container.mesh.triangles = resetMesh.triangles;
|
|
80
|
+
|
|
81
|
+
Container.mesh.vertices = resetMesh.vertices;
|
|
82
|
+
|
|
83
|
+
Container.mesh.uv = resetMesh.uv;
|
|
84
|
+
|
|
85
|
+
Container.mesh.normals = resetMesh.normals;
|
|
86
|
+
|
|
87
|
+
Container.mesh.colors = resetMesh.colors;
|
|
88
|
+
|
|
89
|
+
Container.mesh.tangents = resetMesh.tangents;
|
|
90
|
+
|
|
91
|
+
Container.UpdateGeometry(Container.mesh, 0);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// <summary>
|
|
95
|
+
///
|
|
96
|
+
/// </summary>
|
|
97
|
+
protected virtual void ResolveShatterInstance()
|
|
98
|
+
{
|
|
99
|
+
if (shatterInstance != null)
|
|
100
|
+
{
|
|
101
|
+
shatterInstance.Unready();
|
|
102
|
+
|
|
103
|
+
Destroy(shatterInstance);
|
|
104
|
+
|
|
105
|
+
shatterInstance = null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/// <inheritdoc/>
|
|
111
|
+
public virtual void Shatter(Vector3 hitPoint)
|
|
112
|
+
{
|
|
113
|
+
if (started)
|
|
114
|
+
return;
|
|
115
|
+
|
|
116
|
+
Container.ForceMeshUpdate(); // Force mesh update to get valid data
|
|
117
|
+
|
|
118
|
+
if (shatterInstance != null)
|
|
119
|
+
Destroy(shatterInstance);
|
|
120
|
+
|
|
121
|
+
shatterInstance = Instantiate(shatterProcess);
|
|
122
|
+
|
|
123
|
+
shatterInstance.Shatter(this, hitPoint, Container.mesh);
|
|
124
|
+
|
|
125
|
+
started = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// <inheritdoc/>
|
|
129
|
+
public virtual void OverrideProcess(ScriptableObject shatterProcess)
|
|
130
|
+
{
|
|
131
|
+
if (shatterProcess is ShatterProcessBase process)
|
|
132
|
+
this.shatterProcess = process;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
protected virtual void Update() => CheckShatter();
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
///
|
|
139
|
+
/// </summary>
|
|
140
|
+
protected virtual void CheckShatter()
|
|
141
|
+
{
|
|
142
|
+
if (started)
|
|
143
|
+
{
|
|
144
|
+
started = false;
|
|
145
|
+
|
|
146
|
+
StartCoroutine(shatterInstance.UpdateShatter(UpdateShatterCallback));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// <summary>
|
|
151
|
+
///
|
|
152
|
+
/// </summary>
|
|
153
|
+
/// <param name="newVertices"></param>
|
|
154
|
+
/// <param name="vertexColors"></param>
|
|
155
|
+
protected virtual void UpdateShatterCallback(Vector3[] newVertices, Color[] vertexColors)
|
|
156
|
+
{
|
|
157
|
+
Container.mesh.vertices = newVertices;
|
|
158
|
+
|
|
159
|
+
Container.mesh.colors = vertexColors;
|
|
160
|
+
|
|
161
|
+
Container.UpdateGeometry(Container.mesh, 0);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
protected virtual void OnDrawGizmos()
|
|
166
|
+
{
|
|
167
|
+
if (Application.isPlaying)
|
|
168
|
+
{
|
|
169
|
+
Gizmos.color = Color.yellow;
|
|
170
|
+
|
|
171
|
+
Gizmos.DrawWireMesh(Container.mesh, Container.transform.position);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#region Moving Char by Char Anim Study
|
|
176
|
+
|
|
177
|
+
//void Cope(Vector3 v)
|
|
178
|
+
//{
|
|
179
|
+
// if (v == Vector3.zero)
|
|
180
|
+
// v = new(-5, -1, 0);
|
|
181
|
+
// StartCoroutine(CopeRoutine(v));
|
|
182
|
+
|
|
183
|
+
//}
|
|
184
|
+
//Vector3 L(Vector3 point, Vector3 offset, float t)
|
|
185
|
+
//{
|
|
186
|
+
// Debug.Log(Vector3.Lerp(point, point + offset, t));
|
|
187
|
+
|
|
188
|
+
// return Vector3.Lerp(point, point + offset, t);
|
|
189
|
+
|
|
190
|
+
//}
|
|
191
|
+
//IEnumerator CopeRoutine(Vector3 to, float duration = 1)
|
|
192
|
+
//{
|
|
193
|
+
|
|
194
|
+
// Vector3[] iniV = new Vector3[Container.mesh.vertices.Length];
|
|
195
|
+
// for (int i = 0; i < iniV.Length; i++)
|
|
196
|
+
// {
|
|
197
|
+
// iniV[i] = Container.mesh.vertices[i];
|
|
198
|
+
// }
|
|
199
|
+
// Vector3[] newV = new Vector3[Container.mesh.vertices.Length];
|
|
200
|
+
// for (int i = 0; i < iniV.Length; i++)
|
|
201
|
+
// {
|
|
202
|
+
// newV[i] = iniV[i];
|
|
203
|
+
// }
|
|
204
|
+
|
|
205
|
+
// for (int i = 0; i < Container.mesh.vertices.Length; i += 4) // 4 should be a letter
|
|
206
|
+
// {
|
|
207
|
+
// StartCoroutine(MoveLetter(i, iniV, newV, to, duration));
|
|
208
|
+
// yield return new WaitForSeconds(Time.deltaTime);
|
|
209
|
+
// }
|
|
210
|
+
|
|
211
|
+
// yield break;
|
|
212
|
+
//}
|
|
213
|
+
//IEnumerator MoveLetter(int ind, Vector3[] iniV, Vector3[] newV, Vector3 to, float duration = 1)
|
|
214
|
+
//{
|
|
215
|
+
// float counter = 0;
|
|
216
|
+
// while (counter <= duration || iniV[ind] != iniV[ind] + to)
|
|
217
|
+
// {
|
|
218
|
+
|
|
219
|
+
// //Vector3[] newV = new Vector3[Container.mesh.vertices.Length];
|
|
220
|
+
// for (int i = ind; i < ind + 4; i += 4) // 4 should be a letter
|
|
221
|
+
// {
|
|
222
|
+
|
|
223
|
+
// newV[i] = L(iniV[i], to, counter);
|
|
224
|
+
// newV[i + 1] = L(iniV[i + 1], to, counter);
|
|
225
|
+
// newV[i + 2] = L(iniV[i + 2], to, counter);
|
|
226
|
+
// newV[i + 3] = L(iniV[i + 3], to, counter);
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
// }
|
|
230
|
+
|
|
231
|
+
// Container.mesh.vertices = newV;
|
|
232
|
+
// Container.UpdateGeometry(Container.mesh, 0);
|
|
233
|
+
// if (counter >= duration)
|
|
234
|
+
// yield break;
|
|
235
|
+
|
|
236
|
+
// counter += Time.deltaTime;
|
|
237
|
+
// yield return null;
|
|
238
|
+
// }
|
|
239
|
+
// yield break;
|
|
240
|
+
//}
|
|
241
|
+
|
|
242
|
+
#endregion
|
|
243
|
+
}
|
|
244
244
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 73179b7c4a1fb4d4196f303a08be8623
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 73179b7c4a1fb4d4196f303a08be8623
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|