BookPile GetBookPile() { Collider[] hitcolliders = Physics.OverlapBox( interactor.transform.position, interactor.transform.localScale / 2, interactor.transform.rotation); foreach (Collider col in hitcolliders) { BookPile target = col.gameObject.GetComponentInParent <BookPile>(); if (target != null) { return(target); } } return(null); }
public void OnAltInteract() { PrepTable prepTable = GetPrepTable(); BoatCoffin boat = GetBoatCoffin(); BookPile bookPile = GetBookPile(); Furnace furnace = GetFurnace(); if (prepTable != null) { if (prepTable.hasBody && !carriedCorpse) { carriedCorpse = prepTable.GetCleanBody(); if (carriedCorpse != null) { carriedCorpse.gameObject.SetActive(true); carriedCorpse.dragspot.GetComponent <Rigidbody>().isKinematic = true; } } else if (!prepTable.hasBody && carriedCorpse && carriedCorpse.canBePrepared && !carriedCorpse.isClean) { prepTable.PlaceBody(carriedCorpse); carriedCorpse.gameObject.SetActive(false); carriedCorpse = null; } } if (furnace != null) { if (carriedCorpse && carriedCorpse.canBeIncinerated) { furnace.PlaceBody(carriedCorpse); carriedCorpse.gameObject.SetActive(false); carriedCorpse = null; } } if (bookPile != null) { if (!carriedCorpse && !carriedItem) { carriedItem = bookPile.GetBook(); carriedItem.GetComponent <Rigidbody>().isKinematic = true; } } if (boat != null) { if (!boat.hasBody && carriedCorpse) { boat.PlaceBody(carriedCorpse); carriedCorpse.gameObject.SetActive(false); carriedCorpse.SummonCorpseCartIfNeeded(); carriedCorpse = null; } else if (boat.hasBody && !boat.hasItem && carriedItem) { boat.PlaceItem(carriedItem); carriedItem.gameObject.SetActive(false); carriedItem = null; } else if (boat.hasBody && boat.hasItem && !boat.hasBeenClosed) { boat.CloseLid(); } } }