当前位置: 首页>>代码示例>>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;未经允许,请勿转载。