// void DestroyChicken() { if (died) { return; } died = true; Destroy(gameObject); map.SetChildCount(map.GetChildCount() - 1); if (inWall) { inWall = false; Map6 map6 = (Map6)map; map6.chickenInWall--; if (map6.chickenInWall <= 0) { map6.CancelWall(); } } }
// For map6 void OutWall() { if (inWall) { inWall = false; Map6 map6 = (Map6)map; map6.chickenInWall--; if (map6.chickenInWall <= 0) { map6.CancelWall(); } StartCoroutine(Delay(1f, () => { GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static; GetComponent <Collider2D>().isTrigger = true; TweenRotation twP = TweenRotation.Begin(gameObject, 0.5f, Quaternion.identity); twP.quaternionLerp = true; StartCoroutine(BayLuon()); StartCoroutine(autoCreateEggs()); })); } }