Last active
August 29, 2015 14:04
-
-
Save TakaakiIchijo/6b64234d2238ce25451e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class UIPlayAtom : MonoBehaviour | |
{ | |
public string cueName; //再生するキュー名// | |
public string cueSheet; //再生するキューが入ったキューシート名// | |
public float volume; | |
public flota pitch; | |
static CriAtomSource atomSourceNGUI; | |
static CriAtomListener atomListenerNGUI; | |
Camera cam; | |
void Awake() | |
{ | |
cam = Camera.main; | |
if (cam == null) | |
cam = GameObject.FindObjectOfType(typeof(Camera)) as Camera; | |
//createAtomListener// | |
atomListenerNGUI = cam.gameObject.GetComponent<CriAtomListener>(); | |
if(atomListenerNGUI == null) | |
atomListenerNGUI = cam.gameObject.AddComponent<CriAtomListener>(); | |
//createAtomSource// | |
atomSourceNGUI = cam.gameObject.GetComponent<CriAtomSource>(); | |
if(atomSourceNGUI == null) | |
atomSourceNGUI = cam.gameObject.AddComponent<CriAtomSource>(); | |
if (cueSheet != null) | |
atomSourceNGUI.cueSheet = this.cueSheet; | |
} | |
//NGUITools.PlaySound(audioClip, volume, pitch);の部分をPlayCue ();に差し替える// | |
public void PlayCue () | |
{ | |
atomSourceNGUI.volume = this.volume; | |
atomSourceNGUI.pitch = this.pitch; | |
atomSourceNGUI.Play(cueName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment