コード例 #1
0
        public Sound CreatePooledInstance(SoundClip sc, Vector3 position, GameObject linked = null)
        {
            Sound s = GetPooledInstance <Sound>();

            s.source.clip        = sc.clips[Random.Range(0, sc.clips.Count - 1)];
            s.source.volume      = sc.volume;
            s.source.pitch       = sc.pitch;
            s.transform.position = position;
            s.source.loop        = sc.loop;
            s.linked             = linked;
            if (linked)
            {
                s.wasLinked = true;
            }
            else
            {
                s.wasLinked = false;
            }
            s.source.Play();
            return(s);
        }
コード例 #2
0
        public Sound Play(SoundClip clip, Vector3 position, GameObject linked = null)
        {
            Sound s = soundPrefab.CreatePooledInstance(clip, position, linked);

            return(s);
        }