public override void Action(GameObject obj) { GameObject doc = Instantiate(documentPrefab); doc.transform.position = obj.transform.position; doc.transform.rotation = Quaternion.LookRotation(Camera.main.transform.forward); //doc.transform.Rotate(90, 0, 0); //doc.transform.Rotate(0, 180, 0); doc.transform.Rotate(rotateSpawnOffset); doc.GetComponent <Rigidbody>().isKinematic = true; doc.SetActive(true); Deleteable del = doc.GetComponent <Deleteable>(); if (del.deleteCollection == null) { del.deleteCollection = deleteCollection; } HandInteract hand = obj.GetComponent <HandInteract>(); if (hand) { hand.interactChild = doc.transform; //hand.originalParent = null; } HandState handState = obj.GetComponent <HandState>(); if (hand) { doc.transform.parent = hand.transform; doc.GetComponent <ObjectOutline>().outline.SetActive(false); } }
private void OnTriggerExit(Collider other) { Deleteable del = other.gameObject.GetComponent <Deleteable>(); if (del) { del.onDelete = false; } }
void ResetScene() { foreach (GameObject uo in updateList) { Colourable c = uo.GetComponent <Colourable>(); if (c != null) { c.ResetColour(); } //ColourableTexture ct = uo.GetComponent<ColourableTexture>(); //if (ct != null) //{ // uo.GetComponent<Renderer>().material.color = ct.originalColour; //} SpatialDocument sd = uo.GetComponent <SpatialDocument>(); //if (sd != null) //{ // sd.ResetColour(); //} //DiskInteractible di = uo.GetComponent<DiskInteractible>(); //if (di != null) //{ // di.ResetMaterials(); //} Deleteable d = uo.GetComponent <Deleteable>(); if (d != null) { if (d.deleted) { uo.GetComponent <Deleteable>().deleted = false; if (sd != null) { uo.transform.parent = sd.spawner.transform; } else { // Not sure how to handle this condition, but currently only documents are deleteable uo.transform.parent = null; } } } Brush b = uo.GetComponent <Brush>(); if (b != null) { uo.GetComponent <Renderer>().material.color = Color.white; } //t.gameObject.SetActive(true); } }