private void OnTriggerStay(Collider other) { if (placedObject == null && other.gameObject.CompareTag("Interactable")) { PlaceablePickup placeablePickup = other.gameObject.GetComponent <PlaceablePickup>(); if (placeablePickup != null && placeablePickup.GetPickupType() == placementType && !placeablePickup.ThiefIsHolding) { if (!ghost) { ghost = placeablePickup.CreateGhostObject(transform.position + placeablePickup.GetPosition(), transform.eulerAngles + placeablePickup.GetRotation()); } if (!placeablePickup.ActiveHand && !placeablePickup.Placement) { placeablePickup.Placement = this; PlaceObject(placeablePickup, transform.position + placeablePickup.GetPosition(), transform.eulerAngles + placeablePickup.GetRotation()); DestroyGhost(); } } } }
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); } } } }