public void TriggerExitControl(Transform objectBlocked) { string objectBlockedName = objectBlocked.name; if (objectBlockedName.Contains("SlideBox")) { //base class this when you have time objectBlockedName = objectBlocked.parent.GetComponent <SCR_Movable>().movableObjectString; } else if (objectBlockedName.Contains("RotateBox")) { objectBlockedName = objectBlocked.parent.GetComponent <SCR_Rotatable>().rotatableObjectString; } else if (objectBlockedName.Contains("LimbLight")) { objectBlockedName = "LimbLight"; } switch (objectBlockedName) { case "LightSplitter": objectBlocked.GetComponent <LightSplitter>().OnExit(this.transform); break; case "LightPrismColourCombo": objectBlocked.GetComponent <PrismColourCombo>().TriggerExitFunction(this.transform); break; case "LightTrigger": objectBlocked.GetComponent <LightTrigger>().ForceOnTriggerExit(lineBeam.beamColour); break; case "LightRedirect": objectBlocked.GetComponent <LightRedirect>().TriggerExitFunction(this.transform); break; case "LimbLight": LightRedirect objectRedirect = objectBlocked.GetComponent <LightRedirect>(); if (objectRedirect != null) { objectRedirect.TriggerExitFunction(this.transform); } break; case "Prism": if (objectBlocked.parent.name.Contains("LightSplitter")) { LightSplitter lightSplit = objectBlocked.GetComponentInParent <LightSplitter>(); if (lightSplit != null) { lightSplit.OnExit(this.transform); } } else { objectBlocked.GetComponentInParent <PrismColourCombo>().TriggerExitFunction(this.transform); } break; } }
//Toggles if the light redirect code should be ran or not, as the limbs //toggle from hinge to limb accordingly. Also a beam raycast is also //performed when the object becomes a limb attached unit, to see it //there is already a beam hitting the object back when it was just a //hinge attached. private void LimbOnMode() { lightOn = !lightOn; if (lightOn) { lightRedirect = this.gameObject.AddComponent <LightRedirect>(); lightRedirect.beamLength = beamLength; if (!ArmsBox) { lightRedirect.beamColourRedirectControl = false; lightRedirect.beamColour = beamColour; } CheckDirectionForLightBeam(); } else { if (lightRedirect != null) { lightRedirect.TriggerExitFunction(); Destroy(lightRedirect); } } }