public override void Initialize(Toolset _toolSet) { if (disableSphere != null) { Destroy(disableSphere.gameObject); } base.Initialize(_toolSet); GameObject go; if (spherePos == null) { go = Instantiate(sphere, ToolSet.transform); disableSphere = go.AddComponent <DisableSphere>(); disableSphere.Initialize(0.5f, MaterialHolder.DisableSphereMat, ToolSet.ToolTopPos, new Vector3(0, 0, -1)); } else { go = Instantiate(sphere, spherePos.transform); disableSphere = go.AddComponent <DisableSphere>(); disableSphere.Initialize(0.5f, MaterialHolder.DisableSphereMat, Vector3.forward * 0.05f, Vector3.forward); } go.name = "DisableSphere"; disableSphere.gameObject.SetActive(false); }
//Monobehaviour methods #region private void Start() { if (PlayMode == Mode.VR) { lr = gameObject.GetComponent <LineRenderer>(); } lrPos[0] = Vector3.zero; lrPos[1] = Vector3.forward; cam = GetComponentInParent <Camera>(); Aiming = false; carryGo = new GameObject[GlobalReferences.TemplateParts.Count]; frozenMat = Resources.Load <Material>("Materials/PlacedMaterial"); selectedMat = Resources.Load <Material>("Materials/affectedMaterial"); unselectedMat = Resources.Load <Material>("Materials/unaffectedMaterial"); highlightFrozenMat = Resources.Load <Material>("Materials/highlightPlacedMaterial"); enableSphereMat = Resources.Load <Material>("Materials/Toolset/enableSphereMat"); disableSphereMat = Resources.Load <Material>("Materials/Toolset/disableSphereMat"); trigger = disableSphere.GetComponent <DisableTrigger>(); for (int i = 0; i < GlobalReferences.TemplateParts.Count; ++i) { SpawnObject(i); } carryGo[tempID].SetActive(true); layerMaskPickup = 1 << 8; layerMaskDelete = 1 << 9; disSphere = disableSphere; DisableSphere.SetActive(false); }