public void activateLever() { if (!activated) { activated = true; anim.Play("Activate"); foreach (GameObject obj in objectsToActivate) { obj.SetActive(true); } foreach (GameObject obj in objectsToDestroy) { Destroy(obj); } MusicMGR.PlayAudioClip(soundToPlay, Amount, Timer, timeAdded, useFilter); if (spawnEnemies) { for (int i = 0; i < amountEnemies; i++) { SpawnEnemy(); } } } }
private void FireBullet() { if (fireSound) { MusicMGR.PlayAudioClip(fireSound, 0, 0, 0, false); } fireRate = fireRateSave; currentAmmo -= 1; GameObject newBullet = Instantiate(bullet, barrel.transform.position, barrel.transform.rotation); newBullet.GetComponent <Rigidbody>().AddForce(newBullet.transform.forward * bulletFireSpeed); newBullet.GetComponent <Bullet>().SetStats(damage, destroyBulletOnHit); Destroy(newBullet, 3); }