-
Notifications
You must be signed in to change notification settings - Fork 0
/
Indexer.cs
94 lines (93 loc) · 2.82 KB
/
Indexer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public static class ESS
{
public static GameObject game = GameObject.FindWithTag("DataModel");
public static Transform np = GameObject.FindWithTag("NilContainer").transform;
public static GameObject cam = Camera.main.gameObject;
public static GameObject FindFirstChildG(string name)
{
Transform obj = game.transform;
return obj.Find(name).gameObject;
}
public static Transform FindFirstChildT(string name)
{
Transform obj = game.transform;
return obj.Find(name);
}
public static GameObject FindFirstChildGT(Transform obj,string name)
{
return obj.Find(name).gameObject;
}
public static Transform FindFirstChildTT(Transform obj,string name)
{
return obj.Find(name);
}
public static GameObject FindFirstChildGG(GameObject obj, string name)
{
return obj.transform.Find(name).gameObject;
}
public static Transform FindFirstChildTG(GameObject obj, string name)
{
return obj.transform.Find(name);
}
public static GameObject Clone(GameObject obj, Transform par = null)
{
if (par == null)
par = np;
GameObject temp = UnityEngine.Object.Instantiate(obj, par);
temp.name = obj.name;
return temp;
}
public static GameObject Clone(Transform obj, Transform par = null)
{
if (par == null)
par = np;
GameObject temp = UnityEngine.Object.Instantiate(obj.gameObject, par);
temp.name = obj.name;
return temp;
}
public static AudioSource GetSound(string name)
{
GameObject temp = cam.transform.Find(name).gameObject;
if (temp)
{
return temp.GetComponent<AudioSource>();
}
else
{
Debug.LogWarning("Could not get sound " + name + " because it does not exist.");
return null;
}
}
public static AudioSource GetSound(GameObject src, string name)
{
GameObject temp = src.transform.Find(name).gameObject;
if (temp)
{
return temp.GetComponent<AudioSource>();
}
else
{
Debug.LogWarning("Could not get sound " + name + " because it does not exist.");
return null;
}
}
public static void ClearAllChildren(GameObject src)
{
foreach (Transform child in src.transform)
{
GameObject.Destroy(child.gameObject);
}
}
public static void ClearAllChildren(Transform src)
{
foreach (Transform child in src)
{
GameObject.Destroy(child.gameObject);
}
}
}