IEnumerator EndAfterSeconds() { GetComponent <MovePlayer>().enabled = false; yield return(new WaitForSeconds(.5f)); ScreenShake2D.Shake(0f, 0f); Application.LoadLevel(Application.loadedLevel); }
public void Lose() { scoremanager.FreezeTimer(); scoremanager.MakeScoreRed(); ScreenShake2D.Shake(.25f, .5f); GetComponent <AudioSource>().PlayOneShot(hitsound); GetComponent <AudioSource>().Play(); StartCoroutine("EndAfterSeconds"); }
public void DestroyObstacle(Collider c) { ScreenShake2D.Shake(.25f, 1f); Destroy(c.gameObject); Instantiate(useparticle, c.transform.position, useparticle.transform.rotation); GetComponent <AudioSource>().PlayOneShot(usesound); transform.parent.GetComponent <MovePlayer>().scoremanager.IncrementScore(); powerups--; powerupcounter.text = powerups.ToString(); }