IEnumerator StartAutodestruction() { yield return(new WaitForSeconds(Papierek_Manager_Script.instance().papierekLifeSpan)); if (destroy) { Destroy(gameObject); } }
void OnMouseDown() { //Destroy(gameObject); //StopCoroutine (StartAutodestruction ()); destroy = false; gameObject.GetComponent<SpriteRenderer> ().color = Color.gray; Papierek_Manager_Script pm=Papierek_Manager_Script.instance (); pm.papierkiCount++; GameManager.Instance.AddScore (50f); }
void OnMouseDown() { //Destroy(gameObject); destroy = false; //StopCoroutine (StartAutodestruction ()); Papierek_Manager_Script pm = Papierek_Manager_Script.instance(); pm.papierkiCount++; pm.lifesLeft = pm.lifesLeft - 1; Instantiate(kaczka); GameManager.Instance.AddScore(-100f); }
IEnumerator StartAutodestruction() { yield return new WaitForSeconds (Papierek_Manager_Script.instance ().papierekLifeSpan); if (destroy) { GameObject tmp; tmp =(GameObject)Instantiate(krzyz); //tmp.transform.parent=gameObject.transform; tmp.transform.position=new Vector2(gameObject.transform.position.x+55,gameObject.transform.position.y+30); Instantiate(kaczka); yield return new WaitForSeconds(0.1f); --Papierek_Manager_Script.instance ().lifesLeft; Destroy (gameObject); Destroy (tmp); } }