void SpawnBoatman() { BoatCoffin boat = Instantiate(boatman, transform.position, transform.rotation, transform.parent); boat.boatSpawner = this; boatExists = true; }
public void OnInteract() { if (winLoseScreenButton != null) { winLoseScreenButton.onClick.Invoke(); } BoatCoffin boat = GetBoatCoffin(); if (carriedCorpse == null) { Corpse corpse = GetCorpse(); if (corpse != null) { corpse.ActivateRagdoll(); carriedCorpse = corpse; carriedCorpse.dragspot.GetComponent <Rigidbody>().isKinematic = true; if (carriedItem) { carriedItem.GetComponent <Rigidbody>().MovePosition(throwspot.transform.position); carriedItem.GetComponent <Rigidbody>().isKinematic = false; carriedItem = null; } } } else { carriedCorpse.dragspot.MovePosition(throwspot.transform.position); carriedCorpse.DropCorpse(); carriedCorpse = null; } if (carriedItem == null) { Item item = GetItem(); if (item != null) { Debug.Log("ITEM" + item.name); carriedItem = item; carriedItem.GetComponent <Rigidbody>().isKinematic = true; if (carriedCorpse) { carriedCorpse.dragspot.MovePosition(throwspot.transform.position); carriedCorpse.DropCorpse(); carriedCorpse = null; } } } else { carriedItem.GetComponent <Rigidbody>().MovePosition(throwspot.transform.position); carriedItem.GetComponent <Rigidbody>().isKinematic = false; carriedItem = null; } }
BoatCoffin GetBoatCoffin() { Collider[] hitcolliders = Physics.OverlapBox( interactor.transform.position, interactor.transform.localScale / 2, interactor.transform.rotation); foreach (Collider col in hitcolliders) { BoatCoffin target = col.gameObject.GetComponentInParent <BoatCoffin>(); 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(); } } }