當前位置: 首頁>>代碼示例>>C#>>正文


C# AudioManager類代碼示例

本文整理匯總了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>();
    }
開發者ID:Kurukshetran,項目名稱:Glowball,代碼行數:28,代碼來源:ScriptHelper.cs

示例2: Start

	// Use this for initialization
	void Start ()
	{
		if (am == null) {
			am = GameObject.FindGameObjectWithTag ("AudioManager").GetComponent<AudioManager> ();
			Debug.Log ("Found AudioManager");
		}
	}
開發者ID:stagdage,項目名稱:GameJam2016,代碼行數:8,代碼來源:SliderFindAudioManager.cs

示例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);
        }
開發者ID:dkfdevil,項目名稱:Mine-World,代碼行數:26,代碼來源:GameStateManager.cs

示例4: GetInstance

 public static AudioManager GetInstance()
 {
     if (instance == null) {
         instance = new AudioManager();
     }
     return instance;
 }
開發者ID:Bosphoros,項目名稱:Unity-TowerDefense,代碼行數:7,代碼來源:AudioManager.cs

示例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);
 }
開發者ID:snaptothegrid,項目名稱:Tiler,代碼行數:7,代碼來源:GameOver.cs

示例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);
        }
    }
開發者ID:dany1532,項目名稱:Social_Clues,代碼行數:33,代碼來源:TrainSetTutorial.cs

示例7: Awake

	protected void Awake()
	{
		currency = Dependency.Get<Currency>();
		audioManager = Dependency.Get<AudioManager>();

		storeUI.enabled = false;
	}
開發者ID:Snakybo-School,項目名稱:OUTGEFOUND,代碼行數:7,代碼來源:Store.cs

示例8: Start

 void Start()
 {
     audioManager = AudioManager.Instance;
     if (autoPlayMusic) {
         audioManager.PlayMenuMusic();
     }
 }
開發者ID:thanniaB,項目名稱:censor-me,代碼行數:7,代碼來源:MainMenu.cs

示例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());
    }
開發者ID:MangoSister,項目名稱:Doot-Doot-Cat,代碼行數:8,代碼來源:MainGameManager.cs

示例10: Start

    void Start()
    {
        navigator = Navigator.instance;
        sfx = AudioManager.instance;

        sfx.Play("Audio/Bgm/Music/Alone", 0.5f, 1f, true);
    }
開發者ID:snaptothegrid,項目名稱:Tilebase,代碼行數:7,代碼來源:Home.cs

示例11: Awake

	void Awake ()
	{
		audioManager = GameObject.Find ("AudioManager").GetComponent <AudioManager>();

		screenCrash = GameObject.Find ("ScreenCrash").transform;
		mainCamera = GameObject.Find ("Main Camera").transform;
	}
開發者ID:CountrysideGames,項目名稱:Nostalgia,代碼行數:7,代碼來源:BrickCollision.cs

示例12: Start

 void Start()
 {
     am = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
     transform.Translate (-Vector3.up * 2);
     startPos = transform.position;
     playerTrans = GameObject.FindGameObjectWithTag("Player").transform;
 }
開發者ID:C453,項目名稱:SOLAR,代碼行數:7,代碼來源:EnemyBulletController.cs

示例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);
        }
開發者ID:AmonRGT,項目名稱:CSLMusicMod,代碼行數:7,代碼來源:TagVanillaMood.cs

示例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;
    }
開發者ID:CptDefault,項目名稱:ggj2016,代碼行數:32,代碼來源:AudioManager.cs

示例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);
        }
開發者ID:EvanMachusak,項目名稱:SharpDX,代碼行數:34,代碼來源:SoundEffect.cs


注:本文中的AudioManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。