本文整理汇总了C#中AudioManager类的典型用法代码示例。如果您正苦于以下问题:C# AudioManager类的具体用法?C# AudioManager怎么用?C# AudioManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AudioManager类属于命名空间,在下文中一共展示了AudioManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindScripts
void FindScripts()
{
// Find Controller GameObject
GameObject controller = Camera.main.gameObject;
// Attach scripts that are attached to controller object
sc_CameraController = controller.GetComponent<CameraController>();
sc_GameController = controller.GetComponent<GameController>();
sc_LevelManager = controller.GetComponent<LevelManager>();
sc_RowManager = controller.GetComponent<RowManager>();
// Find Scripts not attached to controller object
sc_AudioManager = GameObject.Find("audio_manager").GetComponent<AudioManager>();
if (LevelName == "Intro") return;
sc_FadeToScene = GameObject.FindGameObjectWithTag("Fade").GetComponent<FadeToScene>();
sc_HighScoreManager = GameObject.FindGameObjectWithTag("Scores").GetComponent<HighScoreManager>();
if (CheckObjectExist("score_tracker"))
sc_ScoreTracker = GameObject.Find("score_tracker").GetComponent<ScoreTracker>();
if (CheckObjectExist("glow_ball"))
sc_BallController = GameObject.Find("glow_ball").GetComponent<BallController>();
if (CheckObjectExist("boundaries"))
sc_BoundaryManager = GameObject.Find("boundaries").GetComponent<BoundaryManager>();
}
示例2: Start
// Use this for initialization
void Start ()
{
if (am == null) {
am = GameObject.FindGameObjectWithTag ("AudioManager").GetComponent<AudioManager> ();
Debug.Log ("Found AudioManager");
}
}
示例3: GameStateManager
public GameStateManager(GraphicsDeviceManager man,ContentManager cman,MineWorldClient gam)
{
Audiomanager = new AudioManager();
Config = new ConfigFile("data/settings.ini");
_inputhelper = new InputHelper();
Game = gam;
Conmanager = cman;
Graphics = man;
Device = Graphics.GraphicsDevice;
SpriteBatch = new SpriteBatch(Device);
_screens = new BaseState[]
{
new TitleState(this, GameState.TitleState),
new MainMenuState(this, GameState.MainMenuState),
new LoadingState(this, GameState.LoadingState),
new MainGameState(this, GameState.MainGameState),
new SettingsState(this, GameState.SettingsState),
_serverbrowsingstate = new ServerBrowsingState(this, GameState.ServerBrowsingState),
_errorstate = new ErrorState(this, GameState.ErrorState)
};
//curScreen = titlestate;
Pbag = new PropertyBag(gam,this);
//Set initial state in the manager itself
SwitchState(GameState.TitleState);
}
示例4: GetInstance
public static AudioManager GetInstance()
{
if (instance == null) {
instance = new AudioManager();
}
return instance;
}
示例5: Awake
void Awake()
{
sfx = AudioManager.instance;
navigator = Navigator.instance;
sfx.Play("Audio/Bgm/Scenes/GameOver", 0, 1f, true);
sfx.Fade("Audio/Bgm/Scenes/GameOver", 0.25f, 0.5f);
}
示例6: Start
// Use this for initialization
void Start()
{
manager = gameObject.GetComponent<AudioManager>();
gameManager = GameObject.Find("TrainManager").GetComponent<TrainManager>();
hand = gameObject.GetComponentInChildren<TutorialHand>();
tutorialCow = GameObject.Find("TutorialCow");
tutorialCow.SetActive(false);
if(GameObject.Find("SelectedTrain") != null)
{
SelectedTrain selectedTrain = GameObject.Find("SelectedTrain").GetComponent<SelectedTrain>();
if (selectedTrain.showTutorial)
{
//Debug.Log("SHOWING TUTORIAL");
StartCoroutine("runTutorial");
}
else
{
//Debug.Log("NOT SHOWING TUTORIAL");
gameManager.startTrain();
Destroy(this.gameObject);
}
}
else
{
//Debug.Log("NOT SHOWING TUTORIAL - selected train not found");
gameManager.startTrain();
Destroy(this.gameObject);
}
}
示例7: Awake
protected void Awake()
{
currency = Dependency.Get<Currency>();
audioManager = Dependency.Get<AudioManager>();
storeUI.enabled = false;
}
示例8: Start
void Start()
{
audioManager = AudioManager.Instance;
if (autoPlayMusic) {
audioManager.PlayMenuMusic();
}
}
示例9: Start
// Use this for initialization
void Start()
{
if(am == null) am = GameObject.Find("AudioManager").GetComponent<AudioManager>();
if(lc == null) lc = GameObject.Find("LevelController").GetComponent<LevelController>();
StartCoroutine(ResetStage());
}
示例10: Start
void Start()
{
navigator = Navigator.instance;
sfx = AudioManager.instance;
sfx.Play("Audio/Bgm/Music/Alone", 0.5f, 1f, true);
}
示例11: Awake
void Awake ()
{
audioManager = GameObject.Find ("AudioManager").GetComponent <AudioManager>();
screenCrash = GameObject.Find ("ScreenCrash").transform;
mainCamera = GameObject.Find ("Main Camera").transform;
}
示例12: Start
void Start()
{
am = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
transform.Translate (-Vector3.up * 2);
startPos = transform.position;
playerTrans = GameObject.FindGameObjectWithTag("Player").transform;
}
示例13: TagApplies
public override bool TagApplies(UnityEngine.GameObject gameObject, AudioManager.ListenerInfo info)
{
SettingsManager.Options ModOptions = gameObject.GetComponent<SettingsManager>().ModOptions;
int finalHappiness = (int)Singleton<DistrictManager>.instance.m_districts.m_buffer[0].m_finalHappiness;
return (finalHappiness < ModOptions.MoodDependentMusic_MoodThreshold);
}
示例14: PlayClip
public static AudioSource PlayClip(AudioClip clip, float volume = 1, float pitch = 1)
{
if (clip == null)
return null;
if (_instance == null)
_instance = FindObjectOfType<AudioManager>();
AudioSource audioSource = null;
foreach (var source in _instance._soundClipPool)
{
if (!source.isPlaying)
{
audioSource = source;
break;
}
}
if (audioSource == null)
{
audioSource = _instance.gameObject.AddComponent<AudioSource>();
_instance._soundClipPool.Add(audioSource);
}
audioSource.clip = clip;
audioSource.volume = volume;
audioSource.pitch = pitch;
audioSource.loop = false;
audioSource.enabled = true;
audioSource.Play();
return audioSource;
}
示例15: SoundEffect
/// <summary>
/// Initializes a new instance of the <see cref="SoundEffect"/> class.
/// </summary>
/// <param name="audioManager">The associated audio manager instance.</param>
/// <param name="name">The name of the current instance.</param>
/// <param name="waveFormat">The format of the current instance.</param>
/// <param name="buffer">The buffer containing audio data.</param>
/// <param name="decodedPacketsInfo">The information regaring decoded packets.</param>
internal SoundEffect(AudioManager audioManager, string name, WaveFormat waveFormat, DataStream buffer, uint[] decodedPacketsInfo)
{
AudioManager = audioManager;
Name = name;
Format = waveFormat;
AudioBuffer = new AudioBuffer
{
Stream = buffer,
AudioBytes = (int)buffer.Length,
Flags = BufferFlags.EndOfStream,
};
LoopedAudioBuffer = new AudioBuffer
{
Stream = buffer,
AudioBytes = (int)buffer.Length,
Flags = BufferFlags.EndOfStream,
LoopCount = AudioBuffer.LoopInfinite,
};
DecodedPacketsInfo = decodedPacketsInfo;
Duration = Format.SampleRate > 0 ? TimeSpan.FromMilliseconds(GetSamplesDuration() * 1000 / Format.SampleRate) : TimeSpan.Zero;
children = new List<WeakReference>();
VoicePool = AudioManager.InstancePool.GetVoicePool(Format);
}