Uh oh!
There was an error while loading. Please reload this page.
forked from IntoTheDev/MultiTag-System-for-Unity
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTagExtensions.cs
More file actions
Latest commit
62 lines (49 loc) · 1.31 KB
/
Copy pathTagExtensions.cs
File metadata and controls
62 lines (49 loc) · 1.31 KB
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
usingUnityEngine;
namespaceToolBox.Tags
{
publicstaticclassTagExtensions
{
publicstaticvoidAddTag(thisGameObjectentity,Tagtag)=>
tag.Add(entity.GetHashCode());
publicstaticvoidRemoveTag(thisGameObjectentity,Tagtag)=>
tag.Remove(entity.GetHashCode());
publicstaticboolHasTag(thisGameObjectentity,Tagtag)=>
tag.HasEntity(entity.GetHashCode());
publicstaticvoidAddTags(thisGameObjectentity,Tag[]tags)
{
inthash=entity.GetHashCode();
for(inti=0;i<tags.Length;i++)
tags[i].Add(hash);
}
publicstaticvoidRemoveTags(thisGameObjectentity,Tag[]tags)
{
inthash=entity.GetHashCode();
for(inti=0;i<tags.Length;i++)
tags[i].Remove(hash);
}
publicstaticboolHasTags(thisGameObjectentity,Tag[]tags,boolallRequired)
{
inthash=entity.GetHashCode();
if(allRequired)
{
for(inti=0;i<tags.Length;i++)
{
if(!tags[i].HasEntity(hash))
returnfalse;
}
returntrue;
}
else
{
for(inti=0;i<tags.Length;i++)
{
if(tags[i].HasEntity(hash))
returntrue;
}
returnfalse;
}
}
publicstaticboolHasTags(thisGameObjectentity,TagsContainertagsContainer,boolallRequired)=>
tagsContainer.HasEntity(entity,allRequired);
}
}