示例#1
0
 public void Play(AudioSource3D source, AudioClip[] soundpack)
 {
     if (soundpack.Length != 0)
     {
         source.PlayOneShot(soundpack[Random.Range(0, soundpack.Length)]);
     }
 }
示例#2
0
文件: Menu.cs 项目: legokor/LeapBlade
        protected void Update()
        {
            pace = 10 * time.DeltaTime;

            if (camTarget)
            {
                camera.position = Vector3.Lerp(camera.position, camTarget.position, pace);
                camera.rotation = Quaternion.Lerp(camera.rotation, camTarget.rotation, pace);
            }

            if (!active)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                selected = (selected + 1) % options.Length;
                source.PlayOneShot(move);
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                selected = (options.Length + selected - 1) % options.Length;
                source.PlayOneShot(move);
            }
            if (Input.GetKeyDown(KeyCode.Return))
            {
                options[selected].onClick.Invoke();
                source.PlayOneShot(select);
            }

            RectTransform target = (RectTransform)options[selected].transform;

            selector.localPosition = Vector3.Lerp(selector.localPosition, target.localPosition + posOffset, pace);
            selector.sizeDelta     = Vector3.Lerp(selector.sizeDelta, target.sizeDelta + scaleOffset, pace);
        }
示例#3
0
 public void PlaySound(AudioClip Sound, float Volume = -1, bool Static = false)
 {
     Source.PlayOneShot(Sound, Volume == -1 ? Source.Volume : Volume, Static);
 }