Example #1
0
        // -------------------------------------------------------------------------------
        // 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);
        }
Example #2
0
        // -------------------------------------------------------------------------------
        // Play
        // -------------------------------------------------------------------------------
        public static SoundObject Play(SoundTemplate tmpl, Vector3 pos)
        {
            SoundObject sound = PlaySound(tmpl);

            if (sound == null)
            {
                return(null);
            }

            sound.transform.position = pos;
            return(sound);
        }
Example #3
0
        // -------------------------------------------------------------------------------
        // 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);
        }
Example #4
0
        // -------------------------------------------------------------------------------
        // Play
        // -------------------------------------------------------------------------------
        public static SoundObject Play(SoundTemplate tmpl)
        {
            SoundObject sound = PlaySound(tmpl);

            return(sound);
        }