Skip to content

Commit 26550d8

Browse files
committed
Adding UI with few hints
1 parent da28409 commit 26550d8

6 files changed

+276
-37
lines changed

Assets/Project/SelectMesh.cs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using Project.Scripts.Fractures;
3+
using UnityEngine;
4+
5+
namespace Project
6+
{
7+
public class SelectMesh : MonoBehaviour
8+
{
9+
[SerializeField] private KeyCodeFractureThisPair[] keyCodeFractureThisPairs;
10+
11+
[Serializable]
12+
private class KeyCodeFractureThisPair
13+
{
14+
public KeyCode KeyCode;
15+
public FractureThis FractureThis;
16+
17+
public void Deconstruct(out KeyCode keyCode, out FractureThis fractureThis)
18+
{
19+
keyCode = KeyCode;
20+
fractureThis = FractureThis;
21+
}
22+
}
23+
24+
private void Update()
25+
{
26+
foreach (var (keyCode, fractureThis) in keyCodeFractureThisPairs)
27+
{
28+
if (Input.GetKeyDown(keyCode))
29+
{
30+
foreach (var chunkGraphManager in FindObjectsOfType<ChunkGraphManager>())
31+
{
32+
DestroyImmediate(chunkGraphManager.gameObject);
33+
}
34+
35+
fractureThis.FractureGameobject();
36+
}
37+
}
38+
}
39+
}
40+
}
File renamed without changes.

Assets/Project/ShowHideUi.cs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using UnityEngine;
2+
3+
namespace Project
4+
{
5+
public class ShowHideUi : MonoBehaviour
6+
{
7+
[SerializeField] private KeyCode keyCode = KeyCode.H;
8+
[SerializeField] private GameObject container;
9+
10+
private void Update()
11+
{
12+
if (Input.GetKeyDown(keyCode))
13+
{
14+
container.SetActive(!container.activeSelf);
15+
}
16+
}
17+
}
18+
}

Assets/Project/ShowHideUi.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scene.unity

+207
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,116 @@ Transform:
223223
m_Father: {fileID: 1875083421}
224224
m_RootOrder: 0
225225
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
226+
--- !u!1 &427716625
227+
GameObject:
228+
m_ObjectHideFlags: 0
229+
m_CorrespondingSourceObject: {fileID: 0}
230+
m_PrefabInstance: {fileID: 0}
231+
m_PrefabAsset: {fileID: 0}
232+
serializedVersion: 6
233+
m_Component:
234+
- component: {fileID: 427716626}
235+
- component: {fileID: 427716630}
236+
- component: {fileID: 427716629}
237+
- component: {fileID: 427716628}
238+
- component: {fileID: 427716627}
239+
m_Layer: 5
240+
m_Name: Text
241+
m_TagString: Untagged
242+
m_Icon: {fileID: 0}
243+
m_NavMeshLayer: 0
244+
m_StaticEditorFlags: 0
245+
m_IsActive: 1
246+
--- !u!224 &427716626
247+
RectTransform:
248+
m_ObjectHideFlags: 0
249+
m_CorrespondingSourceObject: {fileID: 0}
250+
m_PrefabInstance: {fileID: 0}
251+
m_PrefabAsset: {fileID: 0}
252+
m_GameObject: {fileID: 427716625}
253+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
254+
m_LocalPosition: {x: 0, y: 0, z: 0}
255+
m_LocalScale: {x: 1, y: 1, z: 1}
256+
m_Children: []
257+
m_Father: {fileID: 2136614988}
258+
m_RootOrder: 0
259+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
260+
m_AnchorMin: {x: 0, y: 1}
261+
m_AnchorMax: {x: 0, y: 1}
262+
m_AnchoredPosition: {x: 25, y: -25}
263+
m_SizeDelta: {x: 0, y: 0}
264+
m_Pivot: {x: 0, y: 1}
265+
--- !u!114 &427716627
266+
MonoBehaviour:
267+
m_ObjectHideFlags: 0
268+
m_CorrespondingSourceObject: {fileID: 0}
269+
m_PrefabInstance: {fileID: 0}
270+
m_PrefabAsset: {fileID: 0}
271+
m_GameObject: {fileID: 427716625}
272+
m_Enabled: 1
273+
m_EditorHideFlags: 0
274+
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
275+
m_Name:
276+
m_EditorClassIdentifier:
277+
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
278+
m_EffectDistance: {x: 1, y: -1}
279+
m_UseGraphicAlpha: 1
280+
--- !u!114 &427716628
281+
MonoBehaviour:
282+
m_ObjectHideFlags: 0
283+
m_CorrespondingSourceObject: {fileID: 0}
284+
m_PrefabInstance: {fileID: 0}
285+
m_PrefabAsset: {fileID: 0}
286+
m_GameObject: {fileID: 427716625}
287+
m_Enabled: 1
288+
m_EditorHideFlags: 0
289+
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
290+
m_Name:
291+
m_EditorClassIdentifier:
292+
m_HorizontalFit: 2
293+
m_VerticalFit: 2
294+
--- !u!114 &427716629
295+
MonoBehaviour:
296+
m_ObjectHideFlags: 0
297+
m_CorrespondingSourceObject: {fileID: 0}
298+
m_PrefabInstance: {fileID: 0}
299+
m_PrefabAsset: {fileID: 0}
300+
m_GameObject: {fileID: 427716625}
301+
m_Enabled: 1
302+
m_EditorHideFlags: 0
303+
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
304+
m_Name:
305+
m_EditorClassIdentifier:
306+
m_Material: {fileID: 0}
307+
m_Color: {r: 1, g: 1, b: 1, a: 1}
308+
m_RaycastTarget: 1
309+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
310+
m_Maskable: 1
311+
m_OnCullStateChanged:
312+
m_PersistentCalls:
313+
m_Calls: []
314+
m_FontData:
315+
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
316+
m_FontSize: 52
317+
m_FontStyle: 0
318+
m_BestFit: 0
319+
m_MinSize: 10
320+
m_MaxSize: 63
321+
m_Alignment: 0
322+
m_AlignByGeometry: 0
323+
m_RichText: 1
324+
m_HorizontalOverflow: 0
325+
m_VerticalOverflow: 0
326+
m_LineSpacing: 1
327+
m_Text: 1/2/3/4 - Switch Prefabs, H - Hide/Show UI
328+
--- !u!222 &427716630
329+
CanvasRenderer:
330+
m_ObjectHideFlags: 0
331+
m_CorrespondingSourceObject: {fileID: 0}
332+
m_PrefabInstance: {fileID: 0}
333+
m_PrefabAsset: {fileID: 0}
334+
m_GameObject: {fileID: 427716625}
335+
m_CullTransparentMesh: 1
226336
--- !u!1 &455540786
227337
GameObject:
228338
m_ObjectHideFlags: 0
@@ -796,6 +906,103 @@ MonoBehaviour:
796906
FractureThis: {fileID: 6249508}
797907
- KeyCode: 52
798908
FractureThis: {fileID: 519188590}
909+
--- !u!1 &2136614985
910+
GameObject:
911+
m_ObjectHideFlags: 0
912+
m_CorrespondingSourceObject: {fileID: 0}
913+
m_PrefabInstance: {fileID: 0}
914+
m_PrefabAsset: {fileID: 0}
915+
serializedVersion: 6
916+
m_Component:
917+
- component: {fileID: 2136614988}
918+
- component: {fileID: 2136614987}
919+
- component: {fileID: 2136614986}
920+
- component: {fileID: 2136614989}
921+
m_Layer: 5
922+
m_Name: Canvas
923+
m_TagString: Untagged
924+
m_Icon: {fileID: 0}
925+
m_NavMeshLayer: 0
926+
m_StaticEditorFlags: 0
927+
m_IsActive: 1
928+
--- !u!114 &2136614986
929+
MonoBehaviour:
930+
m_ObjectHideFlags: 0
931+
m_CorrespondingSourceObject: {fileID: 0}
932+
m_PrefabInstance: {fileID: 0}
933+
m_PrefabAsset: {fileID: 0}
934+
m_GameObject: {fileID: 2136614985}
935+
m_Enabled: 1
936+
m_EditorHideFlags: 0
937+
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
938+
m_Name:
939+
m_EditorClassIdentifier:
940+
m_UiScaleMode: 1
941+
m_ReferencePixelsPerUnit: 100
942+
m_ScaleFactor: 1
943+
m_ReferenceResolution: {x: 1920, y: 1080}
944+
m_ScreenMatchMode: 0
945+
m_MatchWidthOrHeight: 1
946+
m_PhysicalUnit: 3
947+
m_FallbackScreenDPI: 96
948+
m_DefaultSpriteDPI: 96
949+
m_DynamicPixelsPerUnit: 1
950+
m_PresetInfoIsWorld: 0
951+
--- !u!223 &2136614987
952+
Canvas:
953+
m_ObjectHideFlags: 0
954+
m_CorrespondingSourceObject: {fileID: 0}
955+
m_PrefabInstance: {fileID: 0}
956+
m_PrefabAsset: {fileID: 0}
957+
m_GameObject: {fileID: 2136614985}
958+
m_Enabled: 1
959+
serializedVersion: 3
960+
m_RenderMode: 0
961+
m_Camera: {fileID: 0}
962+
m_PlaneDistance: 100
963+
m_PixelPerfect: 0
964+
m_ReceivesEvents: 1
965+
m_OverrideSorting: 0
966+
m_OverridePixelPerfect: 0
967+
m_SortingBucketNormalizedSize: 0
968+
m_AdditionalShaderChannelsFlag: 0
969+
m_SortingLayerID: 0
970+
m_SortingOrder: 0
971+
m_TargetDisplay: 0
972+
--- !u!224 &2136614988
973+
RectTransform:
974+
m_ObjectHideFlags: 0
975+
m_CorrespondingSourceObject: {fileID: 0}
976+
m_PrefabInstance: {fileID: 0}
977+
m_PrefabAsset: {fileID: 0}
978+
m_GameObject: {fileID: 2136614985}
979+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
980+
m_LocalPosition: {x: 0, y: 0, z: 0}
981+
m_LocalScale: {x: 0, y: 0, z: 0}
982+
m_Children:
983+
- {fileID: 427716626}
984+
m_Father: {fileID: 0}
985+
m_RootOrder: 4
986+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
987+
m_AnchorMin: {x: 0, y: 0}
988+
m_AnchorMax: {x: 0, y: 0}
989+
m_AnchoredPosition: {x: 0, y: 0}
990+
m_SizeDelta: {x: 0, y: 0}
991+
m_Pivot: {x: 0, y: 0}
992+
--- !u!114 &2136614989
993+
MonoBehaviour:
994+
m_ObjectHideFlags: 0
995+
m_CorrespondingSourceObject: {fileID: 0}
996+
m_PrefabInstance: {fileID: 0}
997+
m_PrefabAsset: {fileID: 0}
998+
m_GameObject: {fileID: 2136614985}
999+
m_Enabled: 1
1000+
m_EditorHideFlags: 0
1001+
m_Script: {fileID: 11500000, guid: 8fe9a0696e997ea47813cdcd98183cac, type: 3}
1002+
m_Name:
1003+
m_EditorClassIdentifier:
1004+
keyCode: 104
1005+
container: {fileID: 427716625}
7991006
--- !u!1 &1017753748921270135
8001007
GameObject:
8011008
m_ObjectHideFlags: 0

Assets/SelectMesh.cs

-37
This file was deleted.

0 commit comments

Comments
 (0)