static int createAudioStream(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1); UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2); LeanAudioStream o = LeanAudio.createAudioStream(arg0, arg1); ToLua.PushObject(L, o); return(1); } else if (count == 3) { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1); UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2); LeanAudioOptions arg2 = (LeanAudioOptions)ToLua.CheckObject <LeanAudioOptions>(L, 3); LeanAudioStream o = LeanAudio.createAudioStream(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LeanAudio.createAudioStream")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int generateAudioFromCurve(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1); UnityEngine.AudioClip o = LeanAudio.generateAudioFromCurve(arg0); ToLua.PushSealed(L, o); return(1); } else if (count == 2) { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.AudioClip o = LeanAudio.generateAudioFromCurve(arg0, arg1); ToLua.PushSealed(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LeanAudio.generateAudioFromCurve")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int printOutAudioClip(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2); LeanAudio.printOutAudioClip(arg0, ref arg1); ToLua.PushObject(L, arg1); return(1); } else if (count == 3) { UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2); float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); LeanAudio.printOutAudioClip(arg0, ref arg1, arg2); ToLua.PushObject(L, arg1); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LeanAudio.printOutAudioClip")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void Enter(int num) { if (main.character.tapEnable && ClimberStateManager.state != ClimberState.FLYING) { main.lockTap(); if (!isAnimating) { LeanAudio.play(click, 1f); if (num < 0) // erase last number / Backspace { result = (result - result % 10) / 10; } else { result = result * 10 + num; } ui.SetSolution(result); TrySubmit(); failsafeTimer = 0.1f; timeouts = 0; } } }
public virtual void PlayActiveSound() { if (activeSound) { LeanAudio.playClipAt(activeSound, transform.position).spatialBlend = 1f; } }
public void Ding() { if (checkinSound != null) { LeanAudio.play(checkinSound, 0.8f); } }
public void Show(bool harder) { if (!root.activeSelf) { if (fwoosh != null) { LeanAudio.play(fwoosh); } activeOpen = true; smallButton.Hide(); isShowing = true; isHarder = harder; root.SetActive(true); descrText.text = ContentData.getLabelText("title_MakeHarder"); Vector3 startPos = GetAdjustedPlayerScreenPos(); root.transform.localScale = Vector3.one * 0.2f; comicTail.transform.localScale = Vector3.one * 5; LeanTween.value(root, MoveRoot, startPos, savedPos, animationTime * 0.757f).setEase(LeanTweenType.easeOutExpo); LeanTween.scale(root, Vector3.one, animationTime).setEase(LeanTweenType.easeOutBack); LeanTween.scale(comicTail, Vector3.one, animationTime).setEase(LeanTweenType.easeOutCirc); UpdateTailPos(); } }
static public int constructor(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 LeanAudio o; o = new LeanAudio(); pushValue(l, true); pushValue(l, o); 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 }
public void PlaceItem(ItemObject item) { Ray ray = _camera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out var hitCell, float.PositiveInfinity, whatIsGrid) == false) { Destroy(_tempObject); return; } if (_tempObject.GetComponent <TempObjectHandler>().CanPlaceHere() == false) { Destroy(_tempObject); return; } TempObjectHandler tempObjectHandler = _tempObject.GetComponent <TempObjectHandler>(); tempObjectHandler.MarkCellsAsOccupied(); GameObject newObject = Instantiate(item.prefab, hitCell.transform.position, Quaternion.identity, transform); Rigidbody newObjectRb = newObject.AddComponent <Rigidbody>(); newObjectRb.isKinematic = true; GameData.Main.spawnedItems.Add(item); ItemInfoHolder newObjectInfo = newObject.GetComponent <ItemInfoHolder>(); newObjectInfo.itemObject = item; newObjectInfo.id = GameData.Main.spawnedItems.Count - 1; newObjectInfo.itemObject.sizeOnGrid = tempObjectHandler.GetCellCount(); LeanAudio.play(endPlacingAudio, 0.5f); Destroy(_tempObject); }
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 }
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(); } } }
private void startAction() { if (practiceMode == FMC_PracticeBoxLayout.practiceModes.showPast) { //Debug.Log("Insert Logic for Showing past Tasks herer."); if (FMC_GameDataController.instance) { LeanAudio.play(FMC_GameDataController.instance.buttonClickSound, FMC_GameDataController.instance.buttonClickVolume); } menuController.openPastTasks(); return; } else if (practiceMode == FMC_PracticeBoxLayout.practiceModes.customExercise && menuController) { if (FMC_GameDataController.instance) { LeanAudio.play(FMC_GameDataController.instance.buttonClickSound, FMC_GameDataController.instance.buttonClickVolume); } menuController.playCustomExercise(problemInfo); } else if (menuController) { if (FMC_GameDataController.instance) { LeanAudio.play(FMC_GameDataController.instance.buttonClickSound, FMC_GameDataController.instance.buttonClickVolume); } menuController.playPractice(practiceMode); } }
public static AudioSource play(AudioClip audio, float volume) { AudioSource audioSource = LeanAudio.playClipAt(audio, Vector3.zero); audioSource.volume = volume; return(audioSource); }
// Use this for initialization void Start() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(8.130963E-06f, 0.06526042f, 0f, -1f), new Keyframe(0.0007692695f, 2.449077f, 9.078861f, 9.078861f), new Keyframe(0.01541314f, 0.9343268f, -40f, -40f), new Keyframe(0.05169491f, 0.03835937f, -0.08621139f, -0.08621139f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.003005181f, 0f, 0f), new Keyframe(0.01507768f, 0.002227979f, 0f, 0f)); boomAudioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) })); }
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); }
public void Select(bool anim = true) { if (click != null) { LeanAudio.play(click, 0.2f); } shop.DeselectAll(); isActive = true; if (scaleTween != null) { Debug.Log("Tweening zoom 1" + LeanTween.isTweening(scaleTween.id) + " " + scaleTween.id); } if (!profile.isPurchased && profile.price > shop.bank.balance) { shop.bank.Shake(); } else { if (anim) { skeleton.AnimationState.SetAnimation(0, "tap", false); skeleton.AnimationState.AddAnimation(0, "idle", true, 0); } } if (anim) { scaleTween = LeanTween.scale(gameObject, Vector3.one * 0.8f, 0.1f).setEase(LeanTweenType.easeOutCubic).setOnComplete(() => { scaleTween = LeanTween.scale(gameObject, Vector3.one, 0.15f).setEase(LeanTweenType.easeInOutCubic); }); } UpdateStatus(); }
// Sawtooth Mid-Low Tone 0.5 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.1598466,.007437071,,,8~8,.04856101,.0389016,,-,.3267751,.562929,,,.5,.7185355,-,,8~.1,,,~~0~~2 public AudioClip PlaySawLowHighTone() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.06312931f, 0.0389016f, 0f, -1f), new Keyframe(0.40625f, 0.7185355f, -1f, 0f), new Keyframe(0.65f, 0.2929062f, 0f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.1598466f, 0.007437071f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setWaveSawtooth())); }
// Click Low Tone 0.25 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.01105769,.001647597,,,8~8,,1,,-,.2376075,.7377388,-,,.25,,,,8~~~0~~ public AudioClip PlayLowToneButton() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.1795745f, 0.7224256f, -1f, 0f), new Keyframe(0.25f, 0f, 0f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.01105769f, 0.001647597f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options())); }
// Noise Mid-High Vibrato Tone 0.5 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2680972,.0008237986,,,8~8,.04856101,.0389016,,-,.3267751,.562929,,,.5,.2929062,-,,8~~~0~~3,1000,1 public AudioClip PlayNoiseMidHighTone() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.04856101f, 0.0389016f, 0f, -1f), new Keyframe(0.3267751f, 0.562929f, 0f, 0f), new Keyframe(0.5f, 0.2929062f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2680972f, 0.0008237986f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveNoise().setWaveNoiseScale(1000))); }
// TOO SLOW // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.03811491,.003057325,,,.5,.006242038,,,8~8,.001859264,.9363058,,-,.5,.1804671,-,,8~~~0~~1 public AudioClip PlayTooSlow() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.001859264f, 0.9363058f, 0f, -1f), new Keyframe(0.5f, 0.1804671f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.03811491f, 0.003057325f, 0f, 0f), new Keyframe(0.5f, 0.006242038f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare())); }
// Extra High Pitch END with Vibrato 0.75 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2984478,.0005949656,,,8~8,,1,,-,.5,.7377388,-,,8~.1,,,~~0~~2 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2984478,.0005949656,,,8~8,.002012411,.5548589,,-,.5,.3777429,-,,8~.1,,,~~0~~2 public AudioClip PlayCountdownHighPitchEndVibrato() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.002012411f, 0.5548589f, 0f, -1f), new Keyframe(0.5f, 0.3777429f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2984478f, 0.0005949656f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setWaveSawtooth())); }
// http://leanaudioplay.dentedpixel.com/?d=a:fvb:4,.01002278,.001229508,,,.03234624,.0005327869,,,.05831435,.0003688525,,,.1047836,.008155738,,,4~8,.0001858941,1.033342,,-,.0405467,.8681767,-3,-1.7,.2,.02177083,-,,2~.1,,,~~0~~ public AudioClip PlaySineWaveHighPitch() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.0001858941f, 1.033342f, 0f, -1f), new Keyframe(0.0405467f, 0.8681767f, -3f, -1.7f), new Keyframe(0.2f, 0.02177083f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.01002278f, 0.001229508f, 0f, 0f), new Keyframe(0.03234624f, 0.0005327869f, 0f, 0f), new Keyframe(0.05831435f, 0.0003688525f, 0f, 0f), new Keyframe(0.1047836f, 0.008155738f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }))); }
// COUNTDOWN GO!! // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.02695933,.001464968,,,8~8,,1,,-,.5,.1566879,-,,8~~~0~~1 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.02695933,.001464968,,,8~8,,.1952756,,-,.5,.01889764,-,,8~~~0~~1 public AudioClip PlayCountdownGo() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0f, 0.1952756f, 0f, -1f), new Keyframe(0.5f, 0.01889764f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.02695933f, 0.001464968f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare())); }
// COUNTDOWN // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,1,,-,.5,.2122908,-,,8~~~0~~1 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,.2251969,,-,.5,.03779528,-,,8~~~0~~1 public AudioClip PlayCountdown() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0f, 0.2251969f, 0f, -1f), new Keyframe(0.5f, 0.03779528f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.001987448f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare())); }
// Ambient Low-Mid Vibrato Tone 2.5 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.002,,,2.5,0.002,,,0.001822857f,0.004420519,,1.83897,1.83897,,,.5,.002288329,-,,8~~~0~~3,1000,1 public AudioClip PlayLongAmbientLowMidWaveVibrato() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(-0.001822857f, 0.004420519f, 1.83897f, 1.83897f), new Keyframe(1.261261f, 0.9045518f, 0.02452584f, 0.008126878f), new Keyframe(2.5f, 0.003967403f, -2.285804f, -2.285804f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.002f, 0f, 0f), new Keyframe(2.5f, 0.002f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.003f, 0f, 0f), new Vector3(0.0012f, 0f, 0f), new Vector3(0.0016f, 0f, 0f) }))); }
void CreateCubeButton(int index, Vector2 rotation, float depth) { GameObject cubeButton = Instantiate(cubeButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject; cubeButton.transform.localPosition = new Vector3(Mathf.Sin(rotation.x * (Mathf.PI * 2) / 360) * depth, 0, Mathf.Cos(rotation.x * (Mathf.PI * 2) / 360) * depth); cubeButton.transform.rotation = Quaternion.Euler(new Vector3(rotation.y, rotation.x, 0)); // cubeButton.GetComponent<Renderer>().material = Instantiate(material) as Material; cubeButton.GetComponent <Renderer>().material.color = buttonSettings[index].normalColor; cubeButton.GetComponent <Button>().onClick.AddListener(() => { onGameButtonClick(index); }); cubeButtons.Add(cubeButton); { float length = 2f; float frequency = 0.0001f * ((float)index + 1f); AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(length, 0f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, frequency, 0f, 0f), new Keyframe(length, frequency, 0f, 0f)); LeanAudioOptions audioOptions = LeanAudio.options(); audioOptions.setWaveSine(); audioOptions.setFrequency(44100); AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, audioOptions); cubeButton.GetComponent <AudioSource>().clip = audioClip; } }
void Update() { if (audioClips.Length > 0 && Input.GetKeyDown(KeyCode.F1)) { LeanAudio.playAudio(audioClips[UnityEngine.Random.Range(0, audioClips.Length)], transform.position, 0.5f, 1f); } }
void bigGuyJump() { float height = Mathf.PerlinNoise(jumpIter, 0f) * 10f; height = height * height * 0.3f; // //Debug.Log("height:"+height+" jumpIter:"+jumpIter); LeanTween.moveY(avatarBig, height, 1f).setEase(LeanTweenType.easeInOutQuad).setOnComplete(() => { LeanTween.moveY(avatarBig, 0f, 0.27f).setEase(LeanTweenType.easeInQuad).setOnComplete(() => { LeanTween.cancel(gameObject); /************** * Camera Shake **************/ float shakeAmt = height * 0.2f; // the degrees to shake the camera float shakePeriodTime = 0.42f; // The period of each shake float dropOffTime = 1.6f; // How long it takes the shaking to settle down to nothing LTDescr shakeTween = LeanTween.rotateAroundLocal(gameObject, Vector3.right, shakeAmt, shakePeriodTime) .setEase(LeanTweenType.easeShake) // this is a special ease that is good for shaking .setLoopClamp() .setRepeat(-1); // Slow the camera shake down to zero LeanTween.value(gameObject, shakeAmt, 0f, dropOffTime).setOnUpdate( (float val) => { shakeTween.setTo(Vector3.right * val); } ).setEase(LeanTweenType.easeOutQuad); /******************** * Shake scene objects ********************/ // Make the boxes jump from the big stomping GameObject[] boxes = GameObject.FindGameObjectsWithTag("Respawn"); // I just arbitrarily tagged the boxes with this since it was available in the scene foreach (GameObject box in boxes) { box.GetComponent <Rigidbody>().AddForce(Vector3.up * 100 * height); } // Make the lamps spin from the big stomping GameObject[] lamps = GameObject.FindGameObjectsWithTag("GameController"); // I just arbitrarily tagged the lamps with this since it was available in the scene foreach (GameObject lamp in lamps) { float z = lamp.transform.eulerAngles.z; z = z > 0.0f && z < 180f ? 1 : -1; // push the lamps in whatever direction they are currently swinging lamp.GetComponent <Rigidbody>().AddForce(new Vector3(z, 0f, 0f) * 15 * height); } // Play BOOM! LeanAudio.play(boomAudioClip, transform.position, height * 0.2f); // Like this sound? : http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,0,0.003005181,0,0,0.01507768,0.002227979,0,0,8~8,8.130963E-06,0.06526042,0,-1,0.0007692695,2.449077,9.078861,9.078861,0.01541314,0.9343268,-40,-40,0.05169491,0.03835937,-0.08621139,-0.08621139,8~0.1,0,0,~44100 // Have the jump happen again 2 seconds from now LeanTween.delayedCall(2f, bigGuyJump); }); }); jumpIter += 5.2f; }
public void ShakeCamera(Vector3 side, bool isUp) { LeanTween.cancel(gameObject); transform.localRotation = Quaternion.Euler(Vector3.zero); float height = Mathf.PerlinNoise(force1, 0f) * force2; height = height * height * 0.3f; /************** * Camera Shake **************/ float shakeAmt = height * 0.2f * (isUp ? -1 : 1); // the degrees to shake the camera LTDescr shakeTween = LeanTween.rotateAroundLocal(gameObject, side, shakeAmt, shakePeriodTime) .setEase(LeanTweenType.easeShake) // this is a special ease that is good for shaking .setLoopClamp() .setRepeat(-1); // Slow the camera shake down to zero LeanTween.value(gameObject, shakeAmt, 0f, time).setOnUpdate( (float val) => { shakeTween.setTo(side * val); } ).setEase(LeanTweenType.easeOutQuad); // Play BOOM! LeanAudio.play(boomAudioClip, transform.position, height * 0.2f); // Like this sound? : http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,0,0.003005181,0,0,0.01507768,0.002227979,0,0,8~8,8.130963E-06,0.06526042,0,-1,0.0007692695,2.449077,9.078861,9.078861,0.01541314,0.9343268,-40,-40,0.05169491,0.03835937,-0.08621139,-0.08621139,8~0.1,0,0,~44100 }
// Noise Low-Mid-High-Fade No Vibrato Tone 0.75 // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2873193,.001556064,,,8~8,.05766619,.06864989,,-,.2691089,.3546911,,,.5,.002288329,-,,8~~~0~~3,1000,1 public AudioClip PlaySawLowMidHighTone() { AnimationCurve volumeCurve = new AnimationCurve(new Keyframe(0.05766619f, 0.06864989f, 0f, -1f), new Keyframe(0.2691089f, 0.3546911f, 0f, 0f), new Keyframe(0.5f, 0.002288329f, -1f, 0f)); AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2873193f, 0.001556064f, 0f, 0f)); return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveNoise().setWaveNoiseScale(1000))); }
static int _CreateLeanAudio(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { LeanAudio obj = new LeanAudio(); ToLua.PushObject(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LeanAudio.New"); } } catch(Exception e) { return LuaDLL.toluaL_exception(L, e); } }