/// <summary> /// Changes isOff bool in Particle control script /// </summary> /// <param name="p">Particle control script attached to selected item</param> private void SwitchOnOff(ParticleControl p) { if (p.isOff) { p.isOff = false; } else { p.isOff = true; } }
/// <summary> /// Meant for activating particle effects- turns effects on and off /// If interacting item does not have a Particle Control Script, it means it is a screen and change the material for the screen to mimic the screen turning off /// </summary> /// <param name="selectedItem">collider that user clicks to interact with</param> private void TurnonInteraction() { //interactionEvent.InvokeEvent(); try { ParticleControl interactableSwitch = selectedItem.GetComponent <ParticleControl>(); SwitchOnOff(interactableSwitch); } catch { var materials = selectedItem.GetComponent <TVManager>(); materials.ChangeScreen(); } }