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


C# UnityEngine.AudioSource類代碼示例

本文整理匯總了C#中UnityEngine.AudioSource的典型用法代碼示例。如果您正苦於以下問題:C# AudioSource類的具體用法?C# AudioSource怎麽用?C# AudioSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AudioSource類屬於UnityEngine命名空間,在下文中一共展示了AudioSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Awake

	// Use this for initialization
	void Awake () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = player.GetComponent<playerControl>();
        som = gameObject.GetComponent<AudioSource>();
        bala = gameObject.GetComponent<MeshRenderer>();
	}
開發者ID:paulodgn,項目名稱:humanity_Ambientes,代碼行數:8,代碼來源:playerGetBullets.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        // Script References
        shipGraphics = GetComponent<ShipGraphics>();
        shipPhysicsScript = GetComponent<ShipPhysicsScript>();

        // Component Variables
        cam = GetComponentInChildren<Camera>();
        body = GetComponent<Rigidbody>();
        model = transform.Find("Model").gameObject;
        capsuleCollider = GetComponentInChildren<CapsuleCollider>();
        boxCollider = GetComponentInChildren<BoxCollider>();
        lockSound = GetComponent<AudioSource>();

        // Control Variables
        mouseSensitivity = 8.0f;
        //mouseThreshold = 8.0f;
        //buttonSensitivity = 0.05f;
        //buttonThreshold = 0.05f;

        horTranslation = 0.0f;
        verTranslation = 0.0f;

        enemyNoLock = (Material)Resources.Load("Crosshair");
        enemyLock = (Material)Resources.Load("Crosshair_Enemy");

        trackedObject = null;
        trackingResults = null;
        shootWaitTime = 0.0f;
        targetTime = 0.0f;
        hits = 0;
    }
開發者ID:henryj41043,項目名稱:Project_GRAVITY,代碼行數:33,代碼來源:ShipDataScript.cs

示例3: getAudioSource

 protected AudioSource getAudioSource()
 {
     if(soundEmitter == null) {
         soundEmitter = GetComponent<AudioSource>();
     }
     return soundEmitter;
 }
開發者ID:autarch-design-team,項目名稱:OpenCircuit,代碼行數:7,代碼來源:LandMine.cs

示例4: Start

 void Start()
 {
     audioSource = GetComponent<AudioSource>();
     driver = GameObject.Find("GameDriver") as GameObject;
     shadow = transform.FindChild("RimShadow");
     shadowDistance = (transform.position - shadow.position).magnitude;
 }
開發者ID:Beanalby,項目名稱:1GameAMonth13,代碼行數:7,代碼來源:Rim.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     startShooting = false;
     shootingBullet = false;
     audio = GetComponent<AudioSource>();
     //spawnPosition = GetComponent<Transform>().position;
 }
開發者ID:doesNotUnderstand,項目名稱:Cheez_Plz,代碼行數:8,代碼來源:turret.cs

示例6: Awake

 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D>();
     anim = GetComponent<Animator>();
     aud = GetComponent<AudioSource>();
     jps = transform.GetChild(2).GetComponent<ParticleSystem>();
 }
開發者ID:9,項目名稱:Swordface2.5D,代碼行數:7,代碼來源:IcosaEnemyBrain.cs

示例7: Start

 // Use this for initialization
 void Start()
 {
     controlledObj = mechanism.GetComponent<BatteryControlledObject>();
     source = GetComponent<AudioSource>();
     source.loop = true;
     source.clip = insertSound;
 }
開發者ID:asacoolguy,項目名稱:Immersive-Interaction,代碼行數:8,代碼來源:BatteryPanel.cs

示例8: a0

 void a0()
 {
     audioSource = GetComponent<AudioSource>();
     audioSource.Play();
     Invoke("d", 2.1f);
     Invoke("a1", 10);
 }
開發者ID:kersseliM,項目名稱:syysjamit2015,代碼行數:7,代碼來源:Intro.cs

示例9: Start

    protected void Start()
    {
        audioComponent = GetComponent<AudioSource>();
        audioVolume    = audioComponent.volume;

        audioComponent.enabled = TOD_Sky.Instance.IsDay;
    }
開發者ID:Drenerdo,項目名稱:projectspark,代碼行數:7,代碼來源:AudioAtDay.cs

示例10: Start

	void Start ()
    {
        // 各アビリティボタンの親であるMaskをアタッチしているオブジェクトを取得
        attackParentGO = GameObject.Find("Tab_Action").transform.FindChild("Mask").gameObject;
        defenceParentGO = GameObject.Find("Tab_Support").transform.FindChild("Mask").gameObject;
        reactionParentGO = GameObject.Find("Tab_Reaction").transform.FindChild("Mask").gameObject;
        moveParentGO = GameObject.Find("Tab_Move").transform.FindChild("Mask").gameObject;

        // 初期化としてアタックタブをアクティブ化、それ以外のタブを非アクティブ化する
        attackParentGO.SetActive(true);
        defenceParentGO.SetActive(false);
        reactionParentGO.SetActive(false);
        moveParentGO.SetActive(false);

        // 非アクティブタブのテキスト文字色変更のためタブのテキストコンポを取得
        attackTabTextCompo = GameObject.Find("Tab_Action").transform.FindChild("Text").GetComponent<Text>();
        defenceTabTextCompo = GameObject.Find("Tab_Support").transform.FindChild("Text").GetComponent<Text>();
        reactionTabTextCompo = GameObject.Find("Tab_Reaction").transform.FindChild("Text").GetComponent<Text>();
        moveTabTextCompo = GameObject.Find("Tab_Move").transform.FindChild("Text").GetComponent<Text>();
        // 初期化としてアタックタブ以外を灰色にする
        attackTabTextCompo.color = new Color(255, 255, 255);
        defenceTabTextCompo.color = Color.grey;
        reactionTabTextCompo.color = Color.grey;
        moveTabTextCompo.color = Color.grey;

        // オーディオコンポを取得
        audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
        // TODO 本當はリクワイヤードコンポ屬性を使うべき。上手く動いてくれなかったのでとりあえず
        if (null == audioCompo) audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
    }
開發者ID:yagamiiori,項目名稱:UBTProject,代碼行數:30,代碼來源:AbilityTabActiveSelfChanger.cs

示例11: Start

	public void Start(){ 
		audio = GetComponent<AudioSource> ();
		if (GetComponent<PhotonView> ().isMine) {
			c = Microphone.Start (null, true, 100, freq);
			while(Microphone.GetPosition(null) < 0) {}
		}
	}
開發者ID:sw5813,項目名稱:VRConference,代碼行數:7,代碼來源:MicInput.cs

示例12: Start

    void Start()
    {
        player = GetComponent<Player>();
		audioSource = GetComponent<AudioSource>();
		quadRenderer = GetComponentInChildren<Renderer>();
		startColor = quadRenderer.material.color;

        victoryText.text = "";
        health = 100;
     	
		if(winCount == null) {
			winCount = new int[2];
			winCount[0] = 0;
			winCount[1] = 0;
		}

        deadNow = false;
        if (winCount[player.number] > 0)
        {

            winCountText.text = winCount[player.number].ToString();
            winCountText.text += winCount[player.number] == 1 ? " WIN" : " WINS";
            winCountText.gameObject.SetActive(true);
        }
        Debug.Log("Player " + player.number + "win count = " + winCount[player.number]);
    }
開發者ID:gamesketches,項目名稱:ButtonMashClumpPrototype,代碼行數:26,代碼來源:PlayerHealth.cs

示例13: Start

	void Start () {
		this.anim1 = this.conversante1.GetComponent<Animator> ();
		this.anim2 = this.conversante2.GetComponent<Animator> ();
		
		this.texto = GameObject.Find ("Dialogo").GetComponent<Text> ();
		
		TextAsset archivo = Resources.Load(this.fichero) as TextAsset;
		this.contenidoFichero = archivo.text;
		this.conversaciones = this.contenidoFichero.Split ('\n');
		this.numConver = 0;
		this.primeraConversacion = true;
		this.siguienteConversacion = false;
		
		this.audioActual = this.gameObject.GetComponent<AudioSource> ();
		//Inicializamos el clip del audio.
		this.audioActual.clip = this.audio1;

		//Registramos la informacion del Analytics
		if (Tracker.T () != null) {
			this.registrarTracker ();
		}

		if (this.fichero == "Transicion1")
			this.anim2.SetBool("contenta", false);
	}
開發者ID:gorco,項目名稱:LaCortesiaDeEspa-a,代碼行數:25,代碼來源:ConversacionCutSceneSonido.cs

示例14: Initialize

    void Initialize()
    {
        if (initialized) return;
        initialized = true;

        audioSource = gameObject.GetComponent<AudioSource>();
    }
開發者ID:kenning,項目名稱:popul-vuh,代碼行數:7,代碼來源:CardSFX.cs

示例15: Start

 // Use this for initialization
 void Start()
 {
     lightColors = "Blue";
     canShoot = true;
     Cursor.visible = false;
     audio = GetComponent<AudioSource>();
 }
開發者ID:Ulkan,項目名稱:GLowPod,代碼行數:8,代碼來源:SpawnTree.cs


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