Esempio n. 1
0
    /* Changes the material of the toggle and either undo or redo. */
    public override IEnumerator Toggle()
    {
        if (toggleState == ToggleState.Undo)
        {
            base.TriggerToggled();
            yield return(new WaitForSeconds(toggleAnimationLength / 2));

            meshRenderer.material = redoMaterial; // Changes material halfway through animation
            DMS.DS_AlternateSamples();
            yield return(new WaitForSeconds(toggleAnimationLength / 2));

            toggleState = ToggleState.Redo;
            yield return(null);
        }
        else
        {
            base.TriggerToggled();
            yield return(new WaitForSeconds(toggleAnimationLength / 2));

            meshRenderer.material = undoMaterial; // Changes material halfway through animation
            DMS.DS_AlternateSamples();
            yield return(new WaitForSeconds(toggleAnimationLength / 2));

            toggleState = ToggleState.Undo;
            yield return(null);
        }
    }