// Start is called before the first frame update void Start() { hitSource = GetComponent <AudioSource>(); Vector3 explosionPos = transform.position; Collider[] colliders = Physics.OverlapSphere(explosionPos, radius); foreach (Collider hit in colliders) { Rigidbody rb = hit.GetComponent <Rigidbody>(); if (rb != null) { rb.AddExplosionForce(power, explosionPos, radius, 2.0F); } } hitSource.Play(); StartCoroutine(Wait()); }
// Update is called once per frame void Update() { if (TimeValue > 0) { TimeValue -= Time.deltaTime; } else { if (!playedOnce) { playedOnce = true; GetComponent <AudioSource>().PlayOneShot(bell); foreach (GameObject bell in bells) { bell.GetComponent <Animator>().SetBool("BellRing", true); } //dzwiek dzwonka hero.LoseGame(); } } }