// ------------------------------------------------------------------------------- // PlaySound // ------------------------------------------------------------------------------- private static SoundObject PlaySound(SoundTemplate tmpl) { if (tmpl == null) { return(null); } SoundObject sound = ((GameObject)GameObject.Instantiate(tmpl.soundObjectPrefab)).GetComponent <SoundObject>(); sound.SetClip(tmpl); return(sound); }
// ------------------------------------------------------------------------------- // Play // ------------------------------------------------------------------------------- public static SoundObject Play(SoundTemplate tmpl, Vector3 pos) { SoundObject sound = PlaySound(tmpl); if (sound == null) { return(null); } sound.transform.position = pos; return(sound); }
// ------------------------------------------------------------------------------- // Play // ------------------------------------------------------------------------------- public static SoundObject Play(SoundTemplate tmpl, Transform tran) { SoundObject sound = PlaySound(tmpl); if (sound == null) { return(null); } sound.transform.parent = tran; sound.transform.localPosition = Vector3.zero; return(sound); }
// ------------------------------------------------------------------------------- // Play // ------------------------------------------------------------------------------- public static SoundObject Play(SoundTemplate tmpl) { SoundObject sound = PlaySound(tmpl); return(sound); }