public void RemovePlacedObject() { if (placedObject) { Rigidbody rb = placedObject.GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.None; Ornament ornament = placedObject.GetComponent <Ornament>(); if (ornament) { (this as OrnamentPlacement).SetUnrestIEnumerator(false); //Made By Petter ornament.Placement = null; } else { TaskCardPickup taskCard = placedObject.GetComponent <TaskCardPickup>(); if (taskCard) { taskCard.ScaleTaskCard(false); } } placedObject = null; } }
public void PlaceObject(PlaceablePickup objectToPlace, Vector3 position, Vector3 rotation) { if (!placedObject) { placedObject = objectToPlace.gameObject; Rigidbody rb = placedObject.GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.FreezeAll; placedObject.transform.position = position; placedObject.transform.rotation = Quaternion.Euler(rotation); if (objectToPlace is Ornament) { (this as OrnamentPlacement).CheckGraveCompletion(); (this as OrnamentPlacement).SetUnrestIEnumerator(true); } else { TaskCardPickup taskCard = placedObject.GetComponent <TaskCardPickup>(); if (taskCard) { taskCard.ScaleTaskCard(true); } } } }