|
-
November 18th, 2010, 11:23 AM
#1
Single Public Bool affecting all Instanced Classes
is there a way to have a Single Public Bool affecting all Instanced Classes?
Code:
public class SoundPlayer
{
SoundEffect soundToPlay;
public SoundPlayer(SoundEffect sound)
{
this.soundToPlay = sound;
}
public bool Mute;
public bool MuteGlobal;
public void Play()
{
if (!MuteGlobal)
{
if (!Mute)
{
soundToPlay.Play();
}
}
}
}
Here is the scenario, I have an external soundcard and sometimes its unplugged, if I accidentally run my program with the sounds playing it will crash - I want to create a little bool I can use in Main, to say MuteGlobal, and where-ever SoundPlayer is trying to play - mute every instance of it. Is this possible? As it is I have to got through every class that Soundplayer is in and comment it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|