bool ShouldSoundPlay(string dir) { if (!IsBreakOrHitSound(dir)) { return(true); } BreakableBody.BodyMaterial material = MaterialFromDir(dir); if (IsBreakSound(dir)) { for (int i = 0; i < breakSounds.Count; i++) { if (breakSounds[i].material == material) { return(false); } } BreakSound s = new BreakSound(); s.material = material; breakSounds.Add(s); return(true); } if (IsHitSound(dir)) { for (int i = 0; i < hitSounds.Count; i++) { if (hitSounds[i].material == material) { return(false); } } HitSound s = new HitSound(); s.material = material; hitSounds.Add(s); return(true); } return(true); }
bool ShouldSoundPlay(string dir) { if (!IsBreakOrHitSound(dir)) { return true; } BreakableBody.BodyMaterial material = MaterialFromDir(dir); if (IsBreakSound(dir)) { for (int i = 0; i < breakSounds.Count; i++) { if (breakSounds[i].material == material) { return false; } } BreakSound s = new BreakSound(); s.material = material; breakSounds.Add(s); return true; } if(IsHitSound(dir)) { for (int i = 0; i < hitSounds.Count; i++) { if (hitSounds[i].material == material) { return false; } } HitSound s = new HitSound(); s.material = material; hitSounds.Add(s); return true; } return true; }