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 PerformSwitchOnAction() { if (SwitchOn == null || SwitchOn.Trim().Equals("")) { return; } foreach (var obj in getAllControlledGameObjects()) { var component = obj.GetComponent <Interfaces.ISwitchable>(); if (component != null) { component.ActionSwitchOn(SwitchOn); } } }
// Start is called before the first frame update void Start() { so = GetComponent <SwitchOn>(); }