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,39 +1,39 @@
|
|
|
1
|
-
%YAML 1.1
|
|
2
|
-
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
-
--- !u!84 &8400000
|
|
4
|
-
RenderTexture:
|
|
5
|
-
m_ObjectHideFlags: 0
|
|
6
|
-
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
-
m_PrefabInstance: {fileID: 0}
|
|
8
|
-
m_PrefabAsset: {fileID: 0}
|
|
9
|
-
m_Name: BreakTex
|
|
10
|
-
m_ImageContentsHash:
|
|
11
|
-
serializedVersion: 2
|
|
12
|
-
Hash: 00000000000000000000000000000000
|
|
13
|
-
m_IsAlphaChannelOptional: 0
|
|
14
|
-
serializedVersion: 6
|
|
15
|
-
m_Width: 1920
|
|
16
|
-
m_Height: 1080
|
|
17
|
-
m_AntiAliasing: 1
|
|
18
|
-
m_MipCount: -1
|
|
19
|
-
m_DepthStencilFormat: 92
|
|
20
|
-
m_ColorFormat: 8
|
|
21
|
-
m_MipMap: 0
|
|
22
|
-
m_GenerateMips: 1
|
|
23
|
-
m_SRGB: 0
|
|
24
|
-
m_UseDynamicScale: 0
|
|
25
|
-
m_UseDynamicScaleExplicit: 0
|
|
26
|
-
m_BindMS: 0
|
|
27
|
-
m_EnableCompatibleFormat: 1
|
|
28
|
-
m_EnableRandomWrite: 0
|
|
29
|
-
m_TextureSettings:
|
|
30
|
-
serializedVersion: 2
|
|
31
|
-
m_FilterMode: 1
|
|
32
|
-
m_Aniso: 0
|
|
33
|
-
m_MipBias: 0
|
|
34
|
-
m_WrapU: 1
|
|
35
|
-
m_WrapV: 1
|
|
36
|
-
m_WrapW: 1
|
|
37
|
-
m_Dimension: 2
|
|
38
|
-
m_VolumeDepth: 1
|
|
39
|
-
m_ShadowSamplingMode: 2
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!84 &8400000
|
|
4
|
+
RenderTexture:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
m_Name: BreakTex
|
|
10
|
+
m_ImageContentsHash:
|
|
11
|
+
serializedVersion: 2
|
|
12
|
+
Hash: 00000000000000000000000000000000
|
|
13
|
+
m_IsAlphaChannelOptional: 0
|
|
14
|
+
serializedVersion: 6
|
|
15
|
+
m_Width: 1920
|
|
16
|
+
m_Height: 1080
|
|
17
|
+
m_AntiAliasing: 1
|
|
18
|
+
m_MipCount: -1
|
|
19
|
+
m_DepthStencilFormat: 92
|
|
20
|
+
m_ColorFormat: 8
|
|
21
|
+
m_MipMap: 0
|
|
22
|
+
m_GenerateMips: 1
|
|
23
|
+
m_SRGB: 0
|
|
24
|
+
m_UseDynamicScale: 0
|
|
25
|
+
m_UseDynamicScaleExplicit: 0
|
|
26
|
+
m_BindMS: 0
|
|
27
|
+
m_EnableCompatibleFormat: 1
|
|
28
|
+
m_EnableRandomWrite: 0
|
|
29
|
+
m_TextureSettings:
|
|
30
|
+
serializedVersion: 2
|
|
31
|
+
m_FilterMode: 1
|
|
32
|
+
m_Aniso: 0
|
|
33
|
+
m_MipBias: 0
|
|
34
|
+
m_WrapU: 1
|
|
35
|
+
m_WrapV: 1
|
|
36
|
+
m_WrapW: 1
|
|
37
|
+
m_Dimension: 2
|
|
38
|
+
m_VolumeDepth: 1
|
|
39
|
+
m_ShadowSamplingMode: 2
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 22ee92c194eda804da969f9eb7b7f683
|
|
3
|
-
NativeFormatImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
mainObjectFileID: 8400000
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 22ee92c194eda804da969f9eb7b7f683
|
|
3
|
+
NativeFormatImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
mainObjectFileID: 8400000
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,177 +1,177 @@
|
|
|
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 System.Linq;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
|
|
7
|
-
namespace DREditor.Minigames.Shattering
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
///
|
|
11
|
-
/// </summary>
|
|
12
|
-
[CreateAssetMenu(menuName = "DREditor/Minigames/Shattering/Bullet Shatter Mesh Generator", fileName = "NSD Mesh Generator")]
|
|
13
|
-
public class BulletShatter : MeshGenerator
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[Tooltip("")]
|
|
19
|
-
[SerializeField] protected float forceMultiplier = 550;
|
|
20
|
-
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
[Tooltip("")]
|
|
25
|
-
[SerializeField] protected float maxOffset = 0.36942f;
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
[Tooltip("")]
|
|
31
|
-
[SerializeField] protected float centerBreakFactor = 0.5f;
|
|
32
|
-
|
|
33
|
-
/// <summary>
|
|
34
|
-
///
|
|
35
|
-
/// </summary>
|
|
36
|
-
[Tooltip("")]
|
|
37
|
-
[SerializeField] protected float initialExplosionRadius = 1200;
|
|
38
|
-
|
|
39
|
-
/// <summary>
|
|
40
|
-
///
|
|
41
|
-
/// </summary>
|
|
42
|
-
[Tooltip("")]
|
|
43
|
-
[SerializeField] protected float explosionRadius = 960;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/// <inheritdoc/>
|
|
47
|
-
public override void GenerateMesh(MeshFilter targetMeshFilter, List<UIVertex> uiVertices)
|
|
48
|
-
{
|
|
49
|
-
Mesh mesh = new()
|
|
50
|
-
{
|
|
51
|
-
vertices = ComputeVertices().ToArray()
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
mesh.uv = ComputeUVs(mesh.vertices.ToList(), uiVertices).ToArray();
|
|
55
|
-
|
|
56
|
-
// Set Triangles
|
|
57
|
-
mesh.triangles = Enumerable.Range(0, verticalResolution * horizontalResolution * 6).ToArray();
|
|
58
|
-
|
|
59
|
-
mesh.RecalculateBounds();
|
|
60
|
-
|
|
61
|
-
targetMeshFilter.mesh = mesh;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/// <inheritdoc/>
|
|
65
|
-
protected override List<Vector3> ComputeVertices()
|
|
66
|
-
{
|
|
67
|
-
List<Vector3> vertices = base.ComputeVertices();
|
|
68
|
-
|
|
69
|
-
RandomizeMesh(vertices);
|
|
70
|
-
|
|
71
|
-
return vertices;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/// <summary>
|
|
75
|
-
///
|
|
76
|
-
/// </summary>
|
|
77
|
-
/// <param name="vertices"></param>
|
|
78
|
-
/// <remarks>
|
|
79
|
-
///
|
|
80
|
-
/// </remarks>
|
|
81
|
-
protected virtual void RandomizeMesh(List<Vector3> vertices)
|
|
82
|
-
{
|
|
83
|
-
float averageSize = (Width + Height) / 2;
|
|
84
|
-
|
|
85
|
-
float localMaxOffset = maxOffset * averageSize;
|
|
86
|
-
|
|
87
|
-
int currentVertexIdx = 2;
|
|
88
|
-
|
|
89
|
-
int columns = horizontalResolution - 1;
|
|
90
|
-
|
|
91
|
-
int rows = verticalResolution - 1;
|
|
92
|
-
|
|
93
|
-
int rowStepOffset = verticalResolution * 6;
|
|
94
|
-
|
|
95
|
-
for (int i = 0; i < columns * rows; i++)
|
|
96
|
-
{
|
|
97
|
-
// The vertices that we are suppose to move at each intersection
|
|
98
|
-
int[] sharedVertexIndices =
|
|
99
|
-
{
|
|
100
|
-
currentVertexIdx,
|
|
101
|
-
currentVertexIdx + 2,
|
|
102
|
-
currentVertexIdx + 9,
|
|
103
|
-
currentVertexIdx + rowStepOffset - 1,
|
|
104
|
-
currentVertexIdx + rowStepOffset + 4,
|
|
105
|
-
currentVertexIdx + rowStepOffset + 7
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
Vector3 randomOffset = (Vector3)UnityEngine.Random.insideUnitCircle * localMaxOffset;
|
|
109
|
-
|
|
110
|
-
foreach (int index in sharedVertexIndices)
|
|
111
|
-
{
|
|
112
|
-
Vector3 newPos = vertices[index] + randomOffset;
|
|
113
|
-
|
|
114
|
-
vertices[index] = GetNewPosition(newPos);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Jump to the next column or skip to the next row
|
|
118
|
-
bool isEndOfRow = (i + 1) % rows == 0;
|
|
119
|
-
|
|
120
|
-
if (isEndOfRow)
|
|
121
|
-
currentVertexIdx += 12; // Skip edge vertices to the next row
|
|
122
|
-
else
|
|
123
|
-
currentVertexIdx += 6; // Move to the next quad in the column
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/// <summary>
|
|
128
|
-
///
|
|
129
|
-
/// </summary>
|
|
130
|
-
/// <param name="position"></param>
|
|
131
|
-
/// <returns></returns>
|
|
132
|
-
protected virtual Vector3 GetNewPosition(Vector3 position)
|
|
133
|
-
{
|
|
134
|
-
float distToCenter = Vector3.Distance(Vector3.zero, position);
|
|
135
|
-
|
|
136
|
-
float multiplier = distToCenter / (explosionRadius / 2);
|
|
137
|
-
|
|
138
|
-
return centerBreakFactor * multiplier * position;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/// <inheritdoc/>
|
|
142
|
-
public override Vector3[] InitializeVelocity(List<UIVertex> uiVertices)
|
|
143
|
-
{
|
|
144
|
-
Vector3[] triangleVelocity = base.InitializeVelocity(uiVertices);
|
|
145
|
-
|
|
146
|
-
for (int i = 0; i < uiVertices.Count / 3; i++)
|
|
147
|
-
triangleVelocity[i] = CalculateTriVelocity(i, uiVertices);
|
|
148
|
-
|
|
149
|
-
return triangleVelocity;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/// <summary>
|
|
153
|
-
///
|
|
154
|
-
/// </summary>
|
|
155
|
-
/// <param name="i"></param>
|
|
156
|
-
/// <param name="uiVertices"></param>
|
|
157
|
-
/// <returns></returns>
|
|
158
|
-
protected virtual Vector3 CalculateTriVelocity(int i, List<UIVertex> uiVertices)
|
|
159
|
-
{
|
|
160
|
-
Vector3 a = uiVertices[i * 3].position;
|
|
161
|
-
|
|
162
|
-
Vector3 b = uiVertices[i * 3 + 1].position;
|
|
163
|
-
|
|
164
|
-
Vector3 c = uiVertices[i * 3 + 2].position;
|
|
165
|
-
|
|
166
|
-
Vector3 center = (a + b + c) / 3f;
|
|
167
|
-
|
|
168
|
-
Vector3 direction = center.normalized;
|
|
169
|
-
|
|
170
|
-
float t = center.magnitude / initialExplosionRadius;
|
|
171
|
-
|
|
172
|
-
t = 1 - t;
|
|
173
|
-
|
|
174
|
-
return forceMultiplier * t * direction;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
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 System.Linq;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Minigames.Shattering
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[CreateAssetMenu(menuName = "DREditor/Minigames/Shattering/Bullet Shatter Mesh Generator", fileName = "NSD Mesh Generator")]
|
|
13
|
+
public class BulletShatter : MeshGenerator
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected float forceMultiplier = 550;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected float maxOffset = 0.36942f;
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected float centerBreakFactor = 0.5f;
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
///
|
|
35
|
+
/// </summary>
|
|
36
|
+
[Tooltip("")]
|
|
37
|
+
[SerializeField] protected float initialExplosionRadius = 1200;
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
[Tooltip("")]
|
|
43
|
+
[SerializeField] protected float explosionRadius = 960;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <inheritdoc/>
|
|
47
|
+
public override void GenerateMesh(MeshFilter targetMeshFilter, List<UIVertex> uiVertices)
|
|
48
|
+
{
|
|
49
|
+
Mesh mesh = new()
|
|
50
|
+
{
|
|
51
|
+
vertices = ComputeVertices().ToArray()
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
mesh.uv = ComputeUVs(mesh.vertices.ToList(), uiVertices).ToArray();
|
|
55
|
+
|
|
56
|
+
// Set Triangles
|
|
57
|
+
mesh.triangles = Enumerable.Range(0, verticalResolution * horizontalResolution * 6).ToArray();
|
|
58
|
+
|
|
59
|
+
mesh.RecalculateBounds();
|
|
60
|
+
|
|
61
|
+
targetMeshFilter.mesh = mesh;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <inheritdoc/>
|
|
65
|
+
protected override List<Vector3> ComputeVertices()
|
|
66
|
+
{
|
|
67
|
+
List<Vector3> vertices = base.ComputeVertices();
|
|
68
|
+
|
|
69
|
+
RandomizeMesh(vertices);
|
|
70
|
+
|
|
71
|
+
return vertices;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
///
|
|
76
|
+
/// </summary>
|
|
77
|
+
/// <param name="vertices"></param>
|
|
78
|
+
/// <remarks>
|
|
79
|
+
///
|
|
80
|
+
/// </remarks>
|
|
81
|
+
protected virtual void RandomizeMesh(List<Vector3> vertices)
|
|
82
|
+
{
|
|
83
|
+
float averageSize = (Width + Height) / 2;
|
|
84
|
+
|
|
85
|
+
float localMaxOffset = maxOffset * averageSize;
|
|
86
|
+
|
|
87
|
+
int currentVertexIdx = 2;
|
|
88
|
+
|
|
89
|
+
int columns = horizontalResolution - 1;
|
|
90
|
+
|
|
91
|
+
int rows = verticalResolution - 1;
|
|
92
|
+
|
|
93
|
+
int rowStepOffset = verticalResolution * 6;
|
|
94
|
+
|
|
95
|
+
for (int i = 0; i < columns * rows; i++)
|
|
96
|
+
{
|
|
97
|
+
// The vertices that we are suppose to move at each intersection
|
|
98
|
+
int[] sharedVertexIndices =
|
|
99
|
+
{
|
|
100
|
+
currentVertexIdx,
|
|
101
|
+
currentVertexIdx + 2,
|
|
102
|
+
currentVertexIdx + 9,
|
|
103
|
+
currentVertexIdx + rowStepOffset - 1,
|
|
104
|
+
currentVertexIdx + rowStepOffset + 4,
|
|
105
|
+
currentVertexIdx + rowStepOffset + 7
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
Vector3 randomOffset = (Vector3)UnityEngine.Random.insideUnitCircle * localMaxOffset;
|
|
109
|
+
|
|
110
|
+
foreach (int index in sharedVertexIndices)
|
|
111
|
+
{
|
|
112
|
+
Vector3 newPos = vertices[index] + randomOffset;
|
|
113
|
+
|
|
114
|
+
vertices[index] = GetNewPosition(newPos);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Jump to the next column or skip to the next row
|
|
118
|
+
bool isEndOfRow = (i + 1) % rows == 0;
|
|
119
|
+
|
|
120
|
+
if (isEndOfRow)
|
|
121
|
+
currentVertexIdx += 12; // Skip edge vertices to the next row
|
|
122
|
+
else
|
|
123
|
+
currentVertexIdx += 6; // Move to the next quad in the column
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/// <summary>
|
|
128
|
+
///
|
|
129
|
+
/// </summary>
|
|
130
|
+
/// <param name="position"></param>
|
|
131
|
+
/// <returns></returns>
|
|
132
|
+
protected virtual Vector3 GetNewPosition(Vector3 position)
|
|
133
|
+
{
|
|
134
|
+
float distToCenter = Vector3.Distance(Vector3.zero, position);
|
|
135
|
+
|
|
136
|
+
float multiplier = distToCenter / (explosionRadius / 2);
|
|
137
|
+
|
|
138
|
+
return centerBreakFactor * multiplier * position;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// <inheritdoc/>
|
|
142
|
+
public override Vector3[] InitializeVelocity(List<UIVertex> uiVertices)
|
|
143
|
+
{
|
|
144
|
+
Vector3[] triangleVelocity = base.InitializeVelocity(uiVertices);
|
|
145
|
+
|
|
146
|
+
for (int i = 0; i < uiVertices.Count / 3; i++)
|
|
147
|
+
triangleVelocity[i] = CalculateTriVelocity(i, uiVertices);
|
|
148
|
+
|
|
149
|
+
return triangleVelocity;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/// <summary>
|
|
153
|
+
///
|
|
154
|
+
/// </summary>
|
|
155
|
+
/// <param name="i"></param>
|
|
156
|
+
/// <param name="uiVertices"></param>
|
|
157
|
+
/// <returns></returns>
|
|
158
|
+
protected virtual Vector3 CalculateTriVelocity(int i, List<UIVertex> uiVertices)
|
|
159
|
+
{
|
|
160
|
+
Vector3 a = uiVertices[i * 3].position;
|
|
161
|
+
|
|
162
|
+
Vector3 b = uiVertices[i * 3 + 1].position;
|
|
163
|
+
|
|
164
|
+
Vector3 c = uiVertices[i * 3 + 2].position;
|
|
165
|
+
|
|
166
|
+
Vector3 center = (a + b + c) / 3f;
|
|
167
|
+
|
|
168
|
+
Vector3 direction = center.normalized;
|
|
169
|
+
|
|
170
|
+
float t = center.magnitude / initialExplosionRadius;
|
|
171
|
+
|
|
172
|
+
t = 1 - t;
|
|
173
|
+
|
|
174
|
+
return forceMultiplier * t * direction;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
177
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 8a1731c7e2622884ab8452ffa01a107c
|
|
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: 8a1731c7e2622884ab8452ffa01a107c
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
|
|
3
|
-
namespace DREditor.Minigames.Shattering
|
|
4
|
-
{
|
|
5
|
-
/// <summary>
|
|
6
|
-
///
|
|
7
|
-
/// </summary>
|
|
8
|
-
public interface IShatterableCanvas
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
/// <param name="shatterCamera"></param>
|
|
14
|
-
void SetRenderingCamera(UnityEngine.Camera shatterCamera);
|
|
15
|
-
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
void SetRenderingOverlay();
|
|
20
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
|
|
3
|
+
namespace DREditor.Minigames.Shattering
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
///
|
|
7
|
+
/// </summary>
|
|
8
|
+
public interface IShatterableCanvas
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
/// <param name="shatterCamera"></param>
|
|
14
|
+
void SetRenderingCamera(UnityEngine.Camera shatterCamera);
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
void SetRenderingOverlay();
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: e3d682846d5726f4ab4edba3c234d79f
|
|
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: e3d682846d5726f4ab4edba3c234d79f
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|