IEnumerator ToggleSwitch() { yield return(new WaitForSeconds(0.1f)); while (true) { yield return(new WaitForSeconds(Random.Range(minDelay, maxDelay))); switchToToggle.Interact(); } }
// Update is called once per frame void Update() { if (_controller.CanControl) { if (Input.GetButtonDown("Interact")) { if (_interactableObj != null) { Switch pSwitch = _interactableObj.GetComponent <Switch>(); pSwitch.Interact(gameObject); } } } }
protected override void DoAction() { m_Switch.Interact(); }