-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemVariables.cs
43 lines (42 loc) · 1.45 KB
/
ItemVariables.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace BuilderMenu
{
public class ItemVariables : MonoBehaviour
{
public ItemRecipe Recipe;
public Blueprint blueprint;
public ListItem ItemOnList;
public int ItemOnListIndex;
public SerializableBluePrint SerializableBlueprint;
private List<Behaviour> disabledComponents;
public uint Index;
private void Start()
{
if (!blueprint.Finished)
{
disabledComponents = new List<Behaviour>();
Component[] thisComps = GetComponents(typeof(Behaviour));
Component[] childComps = GetComponentsInChildren(typeof(Behaviour));
foreach (Behaviour c in thisComps)
{
if (c.GetType() != typeof(ItemRecipe) || c.GetType() != typeof(Blueprint) || c.GetType() != typeof(MeshFilter) || c.GetType() != typeof(Renderer) || c.GetType() != typeof(MeshCollider) || c.GetType() != typeof(Collider))
{
disabledComponents.Add(c);
c.enabled = false;
}
}
}
}
public void EnableAgain()
{
foreach (Behaviour b in disabledComponents)
{
b.enabled = true;
}
}
}
}