Example #1
0
    IEnumerator Glitch()
    {
        if (enabled)
        {
            yield return(new WaitForSeconds(onTime));

            StartCoroutine(forceField.SwitchState());
            yield return(new WaitForSeconds(offTime));

            StartCoroutine(forceField.SwitchState());
            StartCoroutine(Glitch());
        }
    }
Example #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player" || other.gameObject.tag == "Obstacle")
     {
         StartCoroutine(forceField.SwitchState());
         anim.Play("ButtonPushed");
     }
 }