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,179 +1,179 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
// Leothedev also helped out a lot
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.Minigames.Shattering
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[System.Serializable]
|
|
12
|
-
public abstract class MeshGenerator : ScriptableObject
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Tooltip("")]
|
|
18
|
-
[SerializeField] protected int horizontalResolution = 16;
|
|
19
|
-
|
|
20
|
-
/// <summary>
|
|
21
|
-
///
|
|
22
|
-
/// </summary>
|
|
23
|
-
[Tooltip("")]
|
|
24
|
-
[SerializeField] protected int verticalResolution = 9;
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
[Tooltip("")]
|
|
30
|
-
[SerializeField] protected float horizontalSize = 1920;
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
[Tooltip("")]
|
|
36
|
-
[SerializeField] protected float verticleSize = 1080;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/// <summary>
|
|
40
|
-
///
|
|
41
|
-
/// </summary>
|
|
42
|
-
protected float Width => horizontalSize / horizontalResolution;
|
|
43
|
-
|
|
44
|
-
/// <summary>
|
|
45
|
-
///
|
|
46
|
-
/// </summary>
|
|
47
|
-
protected float Height => verticleSize / verticalResolution;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
/// <param name="targetMeshFilter"></param>
|
|
54
|
-
/// <param name="uiVertices"></param>
|
|
55
|
-
public abstract void GenerateMesh(MeshFilter targetMeshFilter, List<UIVertex> uiVertices);
|
|
56
|
-
|
|
57
|
-
/// <summary>
|
|
58
|
-
///
|
|
59
|
-
/// </summary>
|
|
60
|
-
/// <param name="uiVertices"></param>
|
|
61
|
-
/// <returns></returns>
|
|
62
|
-
public virtual Vector3[] InitializeVelocity(List<UIVertex> uiVertices) =>
|
|
63
|
-
new Vector3[uiVertices.Count / 3];
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
///
|
|
67
|
-
/// </summary>
|
|
68
|
-
/// <returns></returns>
|
|
69
|
-
protected virtual List<Vector3> ComputeVertices()
|
|
70
|
-
{
|
|
71
|
-
List<Vector3> vertices = new();
|
|
72
|
-
|
|
73
|
-
for (int x = 0; x < horizontalResolution; x++)
|
|
74
|
-
{
|
|
75
|
-
for (int y = 0; y < verticalResolution; y++)
|
|
76
|
-
{
|
|
77
|
-
Vector3 offset = CalculateOffset(x, y);
|
|
78
|
-
|
|
79
|
-
Vector3[] quadVertices = GenerateQuad(Width, Height, offset);
|
|
80
|
-
|
|
81
|
-
vertices.AddRange(quadVertices);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return vertices;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/// <summary>
|
|
89
|
-
///
|
|
90
|
-
/// </summary>
|
|
91
|
-
/// <param name="x"></param>
|
|
92
|
-
/// <param name="y"></param>
|
|
93
|
-
/// <returns></returns>
|
|
94
|
-
protected virtual Vector3 CalculateOffset(float x, float y)
|
|
95
|
-
{
|
|
96
|
-
Vector3 initialOffset = new(Width * x, Height * y);
|
|
97
|
-
|
|
98
|
-
Vector3 dividedSize = new(horizontalSize / 2, verticleSize / 2, 0);
|
|
99
|
-
|
|
100
|
-
Vector3 dividedResolution = new(Width / 2, Height / 2, 0);
|
|
101
|
-
|
|
102
|
-
return initialOffset - dividedSize + dividedResolution;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/// <summary>
|
|
106
|
-
///
|
|
107
|
-
/// </summary>
|
|
108
|
-
/// <param name="width"></param>
|
|
109
|
-
/// <param name="height"></param>
|
|
110
|
-
/// <param name="offset"></param>
|
|
111
|
-
/// <returns></returns>
|
|
112
|
-
protected virtual Vector3[] GenerateQuad(float width, float height, Vector3 offset)
|
|
113
|
-
{
|
|
114
|
-
float w2 = width / 2;
|
|
115
|
-
|
|
116
|
-
float h2 = height / 2;
|
|
117
|
-
|
|
118
|
-
Vector3[] verts = new Vector3[6];
|
|
119
|
-
|
|
120
|
-
// Triangle 1
|
|
121
|
-
verts[0] = new Vector3(-w2, -h2) + offset;
|
|
122
|
-
|
|
123
|
-
verts[1] = new Vector3(-w2, h2) + offset;
|
|
124
|
-
|
|
125
|
-
verts[2] = new Vector3(w2, h2) + offset;
|
|
126
|
-
|
|
127
|
-
// Triangle 2
|
|
128
|
-
verts[3] = new Vector3(-w2, -h2) + offset;
|
|
129
|
-
|
|
130
|
-
verts[4] = new Vector3(w2, h2) + offset;
|
|
131
|
-
|
|
132
|
-
verts[5] = new Vector3(w2, -h2) + offset;
|
|
133
|
-
|
|
134
|
-
return verts;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/// <summary>
|
|
138
|
-
///
|
|
139
|
-
/// </summary>
|
|
140
|
-
/// <param name="computedVertices"></param>
|
|
141
|
-
/// <param name="currentVertices"></param>
|
|
142
|
-
/// <returns></returns>
|
|
143
|
-
protected virtual List<Vector2> ComputeUVs(List<Vector3> computedVertices, List<UIVertex> currentVertices)
|
|
144
|
-
{
|
|
145
|
-
List<Vector2> uVs = new();
|
|
146
|
-
|
|
147
|
-
for (int i = 0; i < computedVertices.Count; i++)
|
|
148
|
-
{
|
|
149
|
-
Vector3 a = computedVertices[i];
|
|
150
|
-
|
|
151
|
-
Vector2 b = GetUV(computedVertices[i]);
|
|
152
|
-
|
|
153
|
-
UIVertex uiv = UIVertex.simpleVert;
|
|
154
|
-
|
|
155
|
-
uiv.position = a;
|
|
156
|
-
|
|
157
|
-
uiv.uv0 = b;
|
|
158
|
-
|
|
159
|
-
currentVertices.Add(uiv);
|
|
160
|
-
|
|
161
|
-
uVs.Add(b);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return uVs;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/// <summary>
|
|
168
|
-
///
|
|
169
|
-
/// </summary>
|
|
170
|
-
/// <param name="position"></param>
|
|
171
|
-
/// <returns></returns>
|
|
172
|
-
protected virtual Vector2 GetUV(Vector2 position)
|
|
173
|
-
{
|
|
174
|
-
Vector2 offsetPosition = position + new Vector2(horizontalSize / 2f, verticleSize / 2f);
|
|
175
|
-
|
|
176
|
-
return offsetPosition / new Vector2(horizontalSize, verticleSize);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
// Leothedev also helped out a lot
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.Minigames.Shattering
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[System.Serializable]
|
|
12
|
+
public abstract class MeshGenerator : ScriptableObject
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected int horizontalResolution = 16;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected int verticalResolution = 9;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected float horizontalSize = 1920;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected float verticleSize = 1080;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
protected float Width => horizontalSize / horizontalResolution;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
protected float Height => verticleSize / verticalResolution;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
/// <param name="targetMeshFilter"></param>
|
|
54
|
+
/// <param name="uiVertices"></param>
|
|
55
|
+
public abstract void GenerateMesh(MeshFilter targetMeshFilter, List<UIVertex> uiVertices);
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
/// <param name="uiVertices"></param>
|
|
61
|
+
/// <returns></returns>
|
|
62
|
+
public virtual Vector3[] InitializeVelocity(List<UIVertex> uiVertices) =>
|
|
63
|
+
new Vector3[uiVertices.Count / 3];
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
///
|
|
67
|
+
/// </summary>
|
|
68
|
+
/// <returns></returns>
|
|
69
|
+
protected virtual List<Vector3> ComputeVertices()
|
|
70
|
+
{
|
|
71
|
+
List<Vector3> vertices = new();
|
|
72
|
+
|
|
73
|
+
for (int x = 0; x < horizontalResolution; x++)
|
|
74
|
+
{
|
|
75
|
+
for (int y = 0; y < verticalResolution; y++)
|
|
76
|
+
{
|
|
77
|
+
Vector3 offset = CalculateOffset(x, y);
|
|
78
|
+
|
|
79
|
+
Vector3[] quadVertices = GenerateQuad(Width, Height, offset);
|
|
80
|
+
|
|
81
|
+
vertices.AddRange(quadVertices);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return vertices;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/// <summary>
|
|
89
|
+
///
|
|
90
|
+
/// </summary>
|
|
91
|
+
/// <param name="x"></param>
|
|
92
|
+
/// <param name="y"></param>
|
|
93
|
+
/// <returns></returns>
|
|
94
|
+
protected virtual Vector3 CalculateOffset(float x, float y)
|
|
95
|
+
{
|
|
96
|
+
Vector3 initialOffset = new(Width * x, Height * y);
|
|
97
|
+
|
|
98
|
+
Vector3 dividedSize = new(horizontalSize / 2, verticleSize / 2, 0);
|
|
99
|
+
|
|
100
|
+
Vector3 dividedResolution = new(Width / 2, Height / 2, 0);
|
|
101
|
+
|
|
102
|
+
return initialOffset - dividedSize + dividedResolution;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/// <summary>
|
|
106
|
+
///
|
|
107
|
+
/// </summary>
|
|
108
|
+
/// <param name="width"></param>
|
|
109
|
+
/// <param name="height"></param>
|
|
110
|
+
/// <param name="offset"></param>
|
|
111
|
+
/// <returns></returns>
|
|
112
|
+
protected virtual Vector3[] GenerateQuad(float width, float height, Vector3 offset)
|
|
113
|
+
{
|
|
114
|
+
float w2 = width / 2;
|
|
115
|
+
|
|
116
|
+
float h2 = height / 2;
|
|
117
|
+
|
|
118
|
+
Vector3[] verts = new Vector3[6];
|
|
119
|
+
|
|
120
|
+
// Triangle 1
|
|
121
|
+
verts[0] = new Vector3(-w2, -h2) + offset;
|
|
122
|
+
|
|
123
|
+
verts[1] = new Vector3(-w2, h2) + offset;
|
|
124
|
+
|
|
125
|
+
verts[2] = new Vector3(w2, h2) + offset;
|
|
126
|
+
|
|
127
|
+
// Triangle 2
|
|
128
|
+
verts[3] = new Vector3(-w2, -h2) + offset;
|
|
129
|
+
|
|
130
|
+
verts[4] = new Vector3(w2, h2) + offset;
|
|
131
|
+
|
|
132
|
+
verts[5] = new Vector3(w2, -h2) + offset;
|
|
133
|
+
|
|
134
|
+
return verts;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
///
|
|
139
|
+
/// </summary>
|
|
140
|
+
/// <param name="computedVertices"></param>
|
|
141
|
+
/// <param name="currentVertices"></param>
|
|
142
|
+
/// <returns></returns>
|
|
143
|
+
protected virtual List<Vector2> ComputeUVs(List<Vector3> computedVertices, List<UIVertex> currentVertices)
|
|
144
|
+
{
|
|
145
|
+
List<Vector2> uVs = new();
|
|
146
|
+
|
|
147
|
+
for (int i = 0; i < computedVertices.Count; i++)
|
|
148
|
+
{
|
|
149
|
+
Vector3 a = computedVertices[i];
|
|
150
|
+
|
|
151
|
+
Vector2 b = GetUV(computedVertices[i]);
|
|
152
|
+
|
|
153
|
+
UIVertex uiv = UIVertex.simpleVert;
|
|
154
|
+
|
|
155
|
+
uiv.position = a;
|
|
156
|
+
|
|
157
|
+
uiv.uv0 = b;
|
|
158
|
+
|
|
159
|
+
currentVertices.Add(uiv);
|
|
160
|
+
|
|
161
|
+
uVs.Add(b);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return uVs;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/// <summary>
|
|
168
|
+
///
|
|
169
|
+
/// </summary>
|
|
170
|
+
/// <param name="position"></param>
|
|
171
|
+
/// <returns></returns>
|
|
172
|
+
protected virtual Vector2 GetUV(Vector2 position)
|
|
173
|
+
{
|
|
174
|
+
Vector2 offsetPosition = position + new Vector2(horizontalSize / 2f, verticleSize / 2f);
|
|
175
|
+
|
|
176
|
+
return offsetPosition / new Vector2(horizontalSize, verticleSize);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
179
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 7fd3157823394894db59b59e1bc43689
|
|
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: 7fd3157823394894db59b59e1bc43689
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using UnityEngine;
|
|
3
|
-
|
|
4
|
-
namespace DREditor.Minigames.Shattering
|
|
5
|
-
{
|
|
6
|
-
/// <summary>
|
|
7
|
-
///
|
|
8
|
-
/// </summary>
|
|
9
|
-
[ClassHeader(nameof(IShatterableCanvas) +
|
|
10
|
-
"\n\n")]
|
|
11
|
-
[RequireComponent(typeof(Canvas))]
|
|
12
|
-
public class RenderCanvasOnShatter : MonoBehaviour, IShatterableCanvas
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Tooltip("")]
|
|
18
|
-
[SerializeField] protected bool disableCanvasOnOverlay = true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
protected Canvas canvas;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
protected virtual void Start() => canvas = GetComponent<Canvas>();
|
|
28
|
-
|
|
29
|
-
/// <inheritdoc/>
|
|
30
|
-
public virtual void SetRenderingCamera(UnityEngine.Camera shatterCamera)
|
|
31
|
-
{
|
|
32
|
-
canvas.renderMode = RenderMode.ScreenSpaceCamera;
|
|
33
|
-
|
|
34
|
-
canvas.worldCamera = shatterCamera;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/// <inheritdoc/>
|
|
38
|
-
public virtual void SetRenderingOverlay()
|
|
39
|
-
{
|
|
40
|
-
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
|
41
|
-
|
|
42
|
-
canvas.worldCamera = null;
|
|
43
|
-
|
|
44
|
-
if (disableCanvasOnOverlay)
|
|
45
|
-
canvas.enabled = false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.Minigames.Shattering
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
[ClassHeader(nameof(IShatterableCanvas) +
|
|
10
|
+
"\n\n")]
|
|
11
|
+
[RequireComponent(typeof(Canvas))]
|
|
12
|
+
public class RenderCanvasOnShatter : MonoBehaviour, IShatterableCanvas
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected bool disableCanvasOnOverlay = true;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
protected Canvas canvas;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
protected virtual void Start() => canvas = GetComponent<Canvas>();
|
|
28
|
+
|
|
29
|
+
/// <inheritdoc/>
|
|
30
|
+
public virtual void SetRenderingCamera(UnityEngine.Camera shatterCamera)
|
|
31
|
+
{
|
|
32
|
+
canvas.renderMode = RenderMode.ScreenSpaceCamera;
|
|
33
|
+
|
|
34
|
+
canvas.worldCamera = shatterCamera;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <inheritdoc/>
|
|
38
|
+
public virtual void SetRenderingOverlay()
|
|
39
|
+
{
|
|
40
|
+
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
|
41
|
+
|
|
42
|
+
canvas.worldCamera = null;
|
|
43
|
+
|
|
44
|
+
if (disableCanvasOnOverlay)
|
|
45
|
+
canvas.enabled = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
48
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 4705c8f69c7f23a4a8f312fef5dfee40
|
|
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: 4705c8f69c7f23a4a8f312fef5dfee40
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
// Leothedev also helped out a lot
|
|
3
|
-
using DREditor.Cameras;
|
|
4
|
-
using DREditor.EventObjects;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
using UnityEngine.UI;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Minigames.Shattering
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[ClassHeader("")]
|
|
14
|
-
public class ShatterCameraRender : MonoBehaviour
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
[Tooltip("")]
|
|
20
|
-
[SerializeField] protected UnityEngine.Camera shatterCamera;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected BoolWithEvent cameraEnabled = null;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
protected IShatterGraphic Shatter => GetComponentInChildren<IShatterGraphic>();
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
protected UnityEngine.Camera TrialCamera =>
|
|
38
|
-
FindAnyObjectByType<DRTrialCamera>().GetComponentInChildren<UnityEngine.Camera>();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
protected virtual void OnEnable()
|
|
42
|
-
{
|
|
43
|
-
Shatter?.OnPreShatter.AddListener(InitializeCamera);
|
|
44
|
-
|
|
45
|
-
Shatter?.OnMeshShattering.AddListener(ResolveCamera);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
protected virtual void OnDisable()
|
|
49
|
-
{
|
|
50
|
-
Shatter?.OnPreShatter.RemoveListener(InitializeCamera);
|
|
51
|
-
|
|
52
|
-
Shatter?.OnMeshShattering.RemoveListener(ResolveCamera);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/// <summary>
|
|
56
|
-
///
|
|
57
|
-
/// </summary>
|
|
58
|
-
protected virtual void InitializeCamera()
|
|
59
|
-
{
|
|
60
|
-
shatterCamera.transform
|
|
61
|
-
.SetPositionAndRotation(TrialCamera.transform.position, TrialCamera.transform.rotation);
|
|
62
|
-
|
|
63
|
-
Graphic shatterGraphic = Shatter as Graphic;
|
|
64
|
-
|
|
65
|
-
shatterCamera.targetTexture = (RenderTexture)shatterGraphic.mainTexture;
|
|
66
|
-
|
|
67
|
-
cameraEnabled.SetValue(true);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/// <summary>
|
|
71
|
-
///
|
|
72
|
-
/// </summary>
|
|
73
|
-
protected virtual void ResolveCamera()
|
|
74
|
-
{
|
|
75
|
-
shatterCamera.targetTexture = null;
|
|
76
|
-
|
|
77
|
-
cameraEnabled.SetValue(false);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
// Leothedev also helped out a lot
|
|
3
|
+
using DREditor.Cameras;
|
|
4
|
+
using DREditor.EventObjects;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using UnityEngine.UI;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Minigames.Shattering
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader("")]
|
|
14
|
+
public class ShatterCameraRender : MonoBehaviour
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Tooltip("")]
|
|
20
|
+
[SerializeField] protected UnityEngine.Camera shatterCamera;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected BoolWithEvent cameraEnabled = null;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
protected IShatterGraphic Shatter => GetComponentInChildren<IShatterGraphic>();
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
protected UnityEngine.Camera TrialCamera =>
|
|
38
|
+
FindAnyObjectByType<DRTrialCamera>().GetComponentInChildren<UnityEngine.Camera>();
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
protected virtual void OnEnable()
|
|
42
|
+
{
|
|
43
|
+
Shatter?.OnPreShatter.AddListener(InitializeCamera);
|
|
44
|
+
|
|
45
|
+
Shatter?.OnMeshShattering.AddListener(ResolveCamera);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected virtual void OnDisable()
|
|
49
|
+
{
|
|
50
|
+
Shatter?.OnPreShatter.RemoveListener(InitializeCamera);
|
|
51
|
+
|
|
52
|
+
Shatter?.OnMeshShattering.RemoveListener(ResolveCamera);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
protected virtual void InitializeCamera()
|
|
59
|
+
{
|
|
60
|
+
shatterCamera.transform
|
|
61
|
+
.SetPositionAndRotation(TrialCamera.transform.position, TrialCamera.transform.rotation);
|
|
62
|
+
|
|
63
|
+
Graphic shatterGraphic = Shatter as Graphic;
|
|
64
|
+
|
|
65
|
+
shatterCamera.targetTexture = (RenderTexture)shatterGraphic.mainTexture;
|
|
66
|
+
|
|
67
|
+
cameraEnabled.SetValue(true);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
///
|
|
72
|
+
/// </summary>
|
|
73
|
+
protected virtual void ResolveCamera()
|
|
74
|
+
{
|
|
75
|
+
shatterCamera.targetTexture = null;
|
|
76
|
+
|
|
77
|
+
cameraEnabled.SetValue(false);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
80
|
}
|