void OnTriggerEnter(Collider other) { GameObject otherGameObject = other.gameObject; if (!other.CompareTag("WellPuppy") || other.isTrigger || accepting == otherGameObject || rejecting.Contains(otherGameObject)) { return; } WellPuppy wellPuppy = other.GetComponentInParent <WellPuppy>(); if (playerController.IsCarryingObject(wellPuppy)) { wellPuppyInTrigger = wellPuppy; return; } other.gameObject.layer = layerSelfOnly; wellPuppy.SetInteractionEnabled(false); string otherName = otherGameObject.transform.parent.name; if (IsCurrentMaterial(colorDeactivated) || (accepting == null && ((IsCurrentMaterial(colorOneMaterial) && otherName.StartsWith(colorOnePrefix)) || (IsCurrentMaterial(colorTwoMaterial) && otherName.StartsWith(colorTwoPrefix))))) { StartCoroutine(Accept(otherGameObject)); } else { StartCoroutine(Reject(other)); } }
private void teleportPuppy(WellPuppy puppy) { Rigidbody puppyBody = puppy.GetComponent <Rigidbody>(); puppyBody.MovePosition(location.position); puppyBody.velocity = Vector3.zero; }
void Update() { if (carriedPuppyInNet != null && !playerController.IsCarryingObject(carriedPuppyInNet)) { teleportPuppy(carriedPuppyInNet); carriedPuppyInNet = null; } }
void OnTriggerExit(Collider other) { if (wellPuppyInTrigger == null) { return; } WellPuppy wellPuppy = other.GetComponentInParent <WellPuppy>(); if (wellPuppy == wellPuppyInTrigger) { wellPuppyInTrigger = null; } }
void OnTriggerExit(Collider other) { if (!other.CompareTag("WellPuppy")) { return; } WellPuppy puppy = other.GetComponentInParent <WellPuppy>(); if (puppy == carriedPuppyInNet) { carriedPuppyInNet = null; } }
void OnTriggerEnter(Collider other) { if (!other.CompareTag("WellPuppy")) { return; } WellPuppy puppy = other.GetComponentInParent <WellPuppy>(); if (puppy != null) { if (playerController.IsCarryingObject(puppy)) { carriedPuppyInNet = puppy; } else { teleportPuppy(puppy); } } }