void OnMouseOver() { if (Input.GetKeyDown(KeyCode.Mouse0) && !IsOn) { IsOn = true; SwitchOn.Invoke(); } else if (Input.GetKeyDown(KeyCode.Mouse0) && IsOn) { IsOn = false; SwitchOff.Invoke(); } }
private void PerformSwitchOffAction() { if (SwitchOff == null || SwitchOff.Trim().Equals("")) { return; } foreach (var obj in getAllControlledGameObjects()) { var component = obj.GetComponent <Interfaces.ISwitchable>(); if (component != null) { component.ActionSwitchOff(SwitchOff); } } }