/* Changes the material of the toggle and either plays or pauses the dummy. */ public override IEnumerator Toggle() { if (toggleState == ToggleState.Pause) { base.TriggerToggled(); yield return(new WaitForSeconds(toggleAnimationLength / 2)); meshRenderer.material = playMaterial; // Changes material halfway through animation DMS.DS_StartPlaying(); yield return(new WaitForSeconds(toggleAnimationLength / 2)); toggleState = ToggleState.Play; yield return(null); } else { base.TriggerToggled(); yield return(new WaitForSeconds(toggleAnimationLength / 2)); meshRenderer.material = pauseMaterial; // Changes material halfway through animation DMS.DS_StopPlaying(); yield return(new WaitForSeconds(toggleAnimationLength / 2)); toggleState = ToggleState.Pause; yield return(null); } }