public void GrabObject(Collider other) { AkSoundEngine.PostEvent("ghost_laugh", gameObject); GManager.Instance.NetworkedObjectDestroy(other.gameObject); newHeldObj = PlayerObjectInteraction.HoldableType.Pickup; ShowFakeObject(other.GetComponent <PickupableObject>().Type); }
public void DropPickup() { HideFakeObject(); newHeldObj = PlayerObjectInteraction.HoldableType.None; GameObject throwableToSpawn = null; throwableToSpawn = GManager.Instance.GetCachedObject(heldObjectType); Transform positionToSpawnAt = fakeObjects[(int)heldObjectType].transform; throwableToSpawn.transform.position = positionToSpawnAt.position; throwableToSpawn.transform.rotation = positionToSpawnAt.rotation; if (heldObjectType != PickupableObject.PickupableType.Torch) { throwableToSpawn.GetComponent <Rigidbody>().useGravity = true; throwableToSpawn.GetComponent <Rigidbody>().isKinematic = false; throwableToSpawn.GetComponent <Collider>().isTrigger = false; } else { AkSoundEngine.PostEvent("torch_place", gameObject); throwableToSpawn.GetComponent <Rigidbody>().useGravity = false; throwableToSpawn.GetComponent <Collider>().isTrigger = true; } if (isServer) { GManager.Instance.CachedObjectWasUsed(heldObjectType, true); } Quaternion oppositeRotation = movableAI.transform.rotation; oppositeRotation.y = -movableAI.transform.rotation.y; movableAI.transform.rotation = oppositeRotation; movableAI.targetRotation = oppositeRotation.eulerAngles; movableAI.velocity = Vector3.zero; movableAI.GetComponent <Ghost>().isHittingWall = false; }
private void CommonHideFakeObject() { fakeObjects[(int)heldObjectType].SetActive(false); newHeldObj = PlayerObjectInteraction.HoldableType.None; }