void HandleOnGateClosed(BlackHoleGate gate) { if (!fx.isPlaying) { return; } fx.Stop(); }
void HandleOnGateOpen(BlackHoleGate gate) { if (fx.isPlaying) { return; } fx.Play(); }
private void Awake() { // Set gate handles BlackHoleGate bhg = gateController.GetComponent <BlackHoleGate>(); bhg.OnGateClosed += HandleOnGateClosed; bhg.OnGateOpen += HandleOnGateOpen; // Create new material //mat = new Material(renderersToColorize[0].material); mat = new Material(material); // Set the new material to each renderer foreach (Renderer rend in renderersToColorize) { rend.sharedMaterial = mat; } Colorize(); fx.Play(); //CheckGate(); }