void OnTriggerExit(Collider col) { ShadeHole shadeHole = col.GetComponent <ShadeHole>(); if (shadeHole != null) { shadeHoleObject = col.gameObject; shadeHole.TriggerShadhole(true, 0.0f); } }
void OnDestroy() { if (shadeHoleObject != null) { ShadeHole shadeHole = shadeHoleObject.GetComponent <ShadeHole>(); if (shadeHole != null) { shadeHole.TriggerShadhole(true, 0.0f); } } }
void ShootRay(Vector3 OriginPosition, Vector3 Direction, float LightDistance, bool isTurnOn, Color lightSourceColor) { RaycastHit[] allObjectHit = Physics.RaycastAll(OriginPosition, Direction, LightDistance); Debug.DrawLine(OriginPosition, OriginPosition + Direction * LightDistance); bool isCastingFinished = true; if (allObjectHit != null) { allObjectHit = allObjectHit.Where(x => x.transform.GetComponent <ShadowDoorTrigger> () != null || x.transform.GetComponent <ShadeHole> () != null || x.transform.GetComponent <PocaPetal> () != null).ToArray(); foreach (RaycastHit objectHit in allObjectHit) { ShadeHole shh = objectHit.transform.gameObject.GetComponent <ShadeHole> (); PocaPetal pu = objectHit.transform.gameObject.GetComponent <PocaPetal> (); ShadowDoorTrigger sdo = objectHit.transform.gameObject.GetComponent <ShadowDoorTrigger> (); if (pu) { if (!thisPocaUnusable) { pu.HasLight(isTurnOn, lightSourceColor, naivisSource); isCastingFinished = false; } else { if (thisPocaUnusable != pu) { pu.HasLight(isTurnOn, lightSourceColor, naivisSource); isCastingFinished = false; } } } if (shh) { shh.TriggerShadhole(!isTurnOn, (!isTurnOn) ? cAnimator.fadingTime * 0.2f : 0f); } if (sdo) { sdo.TriggerShadowDoor(isTurnOn, (!isTurnOn) ? cAnimator.fadingTime * 0.2f : 0f); } } } if (isCastingFinished && isTurnOn) { if (naivisSource != null) { naivisSource.FinishLightCasting(); } } }
void OnTriggerStay(Collider col) { ShadeHole shadeHole = col.GetComponent <ShadeHole>(); if (shadeHole != null) { shadeHoleObject = col.gameObject; if (isStay && shadeHole.state) { isStay = false; } if (!isStay) { isStay = true; shadeHole.TriggerShadhole(false, 0.0f); } } }