playClipAt() public static method

public static playClipAt ( AudioClip clip, Vector3 pos ) : AudioSource
clip UnityEngine.AudioClip
pos Vector3
return UnityEngine.AudioSource
Ejemplo n.º 1
0
 void playBoom()
 {
     //AnimationCurve volumeCurve = new AnimationCurve( new Keyframe(-0.001454365f, 0.006141067f, -3.698472f, -3.698472f), new Keyframe(0.004859668f, 1.392618f, -4.544237f, -4.544237f), new Keyframe(0.9999977f, 0.00601998f, -0.1788428f, -0.1788428f));
     //AnimationCurve frequencyCurve = new AnimationCurve( new Keyframe(2.99277E-05f, 0.002244899f, 0.01912267f, 0.01912267f), new Keyframe(0.9984757f, 0.06040816f, 0f, 0f));
     //AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, new LeanAudioOptions().setVibrato( new Vector3[]{ new Vector3(0.002f,0.6f,0f)} ));
     LeanAudio.playClipAt(boomClip, Vector3.zero);
 }
Ejemplo n.º 2
0
        private void OnSwitch(bool up, Switchable source)
        {
            // We know these are 1-based
            if (int.TryParse(source.name, out int id))
            {
                if (!selectedSwitches.Contains(id))
                {
                    selectedSwitches.Add(id);
                }

                if (!up)
                {
                    if (id == correctFuseToSwitchOff)
                    {
                        spitznsparkz.SetActive(false);
                        Finish();
                    }
                }
                else if (id == 11 || id == 13)
                {
                    catastrophicFail = true;
                    spitznsparkz.SetActive(true);
                    LeanAudio.playClipAt(scream, spitznsparkz.transform.position);
                    Finish();
                }
            }
        }
Ejemplo n.º 3
0
 public virtual void PlayActiveSound()
 {
     if (activeSound)
     {
         LeanAudio.playClipAt(activeSound, transform.position).spatialBlend = 1f;
     }
 }
Ejemplo n.º 4
0
    public static AudioSource play(AudioClip audio, float volume)
    {
        AudioSource audioSource = LeanAudio.playClipAt(audio, Vector3.zero);

        audioSource.volume = volume;
        return(audioSource);
    }
Ejemplo n.º 5
0
 static public int playClipAt_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AudioClip a1;
         checkType(l, 1, out a1);
         UnityEngine.Vector3 a2;
         checkType(l, 2, out a2);
         var ret = LeanAudio.playClipAt(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Ejemplo n.º 6
0
    public static AudioSource play(AudioClip audio, Vector3 pos, float volume)
    {
        AudioSource audioSource = LeanAudio.playClipAt(audio, pos);

        audioSource.minDistance = 1f;
        audioSource.volume      = volume;
        return(audioSource);
    }
Ejemplo n.º 7
0
    void playBoom()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(-0.001454365f, 0.006141067f, -3.698472f, -3.698472f), new Keyframe(0.01393294f, 2f, -3.613532f, -3.613532f), new Keyframe(0.9999977f, 0.00601998f, -0.1788428f, -0.1788428f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(2.99277E-05f, 0.002244899f, 0.01912267f, 0.01912267f), new Keyframe(0.9984757f, 0.06040816f, 0f, 0f));
        AudioClip      audioClip      = LeanAudio.createAudio(volumeCurve, frequencyCurve, new LeanAudioOptions().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setFrequency(11025));

        LeanAudio.playClipAt(audioClip, Vector3.zero);
    }
Ejemplo n.º 8
0
 public void PopUp(float time = 0f)
 {
     upTime            = time;
     isActive          = true;
     shootable.Dormant = false;
     timeCounter       = 0f;
     gameObject.SetActive(true);
     if (popupNoise)
     {
         LeanAudio.playClipAt(popupNoise, transform.position).spatialBlend = 1f;
     }
     LeanTween.rotateLocal(gameObject, endAngle, popTime)
     .setEaseOutBounce();
 }
Ejemplo n.º 9
0
 public virtual void SetActiveHarm(bool harm)
 {
     IsHarmful = harm;
     if (activeVisual)
     {
         activeVisual.SetActive(harm);
     }
     if (audioLooper)
     {
         audioLooper.Sync(harm);
     }
     if (activeSound && harm)
     {
         LeanAudio.playClipAt(activeSound, transform.position).spatialBlend = 1f;
     }
 }
Ejemplo n.º 10
0
 static public int playClipAt_s(IntPtr l)
 {
     try {
         UnityEngine.AudioClip a1;
         checkType(l, 1, out a1);
         UnityEngine.Vector3 a2;
         checkType(l, 2, out a2);
         var ret = LeanAudio.playClipAt(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 11
0
 static int playClipAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AudioClip   arg0 = (UnityEngine.AudioClip)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.AudioClip));
         UnityEngine.Vector3     arg1 = ToLua.ToVector3(L, 2);
         UnityEngine.AudioSource o    = LeanAudio.playClipAt(arg0, arg1);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 12
0
 public static AudioSource play(AudioClip audio, Vector3 pos)
 {
     return(LeanAudio.playClipAt(audio, pos));
 }
Ejemplo n.º 13
0
 public void Roll()
 {
     LeanAudio.playClipAt(roll, transform.position).spatialBlend = .5f;
 }
Ejemplo n.º 14
0
 public void RightFoot()
 {
     LeanAudio.playClipAt(rightFoot, hostObject.position);
 }
Ejemplo n.º 15
0
 public void Roll()
 {
     LeanAudio.playClipAt(roll, hostObject.position);
 }
Ejemplo n.º 16
0
 public void Skid()
 {
     LeanAudio.playClipAt(skid, hostObject.position);
 }
Ejemplo n.º 17
0
 public void Skid()
 {
     LeanAudio.playClipAt(skid, transform.position).spatialBlend = .5f;
 }
Ejemplo n.º 18
0
 public void RightFoot()
 {
     LeanAudio.playClipAt(rightFoot, transform.position).spatialBlend = .5f;
 }
Ejemplo n.º 19
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    //override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateMove is called right after Animator.OnAnimatorMove()
    //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //    // Implement code that processes and affects root motion
    //}

    // OnStateIK is called right after Animator.OnAnimatorIK()
    //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //    // Implement code that sets up animation IK (inverse kinematics)
    //}


    public void LeftFoot()
    {
        LeanAudio.playClipAt(leftFoot, hostObject.position);
    }