IEnumerator BeatCo() { while (true) { //soundPlayer.PlayOneShot(0); LeanTween.scale(gameObject, initScale * 0.9f, betweenBeatShort).setEase(LeanTweenType.easeInCirc); yield return(new WaitForSeconds(betweenBeatShort)); soundPlayer.PlayOneShot(0); LeanTween.scale(gameObject, initScale, betweenBeatShort).setEase(LeanTweenType.easeOutCirc); yield return(new WaitForSeconds(betweenBeatShort)); LeanTween.scale(gameObject, initScale * 0.9f, betweenBeatShort).setEase(LeanTweenType.easeInCirc); yield return(new WaitForSeconds(betweenBeatShort)); LeanTween.scale(gameObject, initScale, betweenBeatShort).setEase(LeanTweenType.easeOutCirc); yield return(new WaitForSeconds(betweenBeatLong)); } }
IEnumerator RejectItemCo(ObtainableItem item) { Debug.Log(item + " has been rejected by the cauldron."); var itemRigidbody = item.GetComponent <Rigidbody>(); if (itemRigidbody != null) { itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); var targetPosition = pointOnSurface.position; LeanTween.move(item.gameObject, targetPosition, 0.5f); yield return(new WaitForSeconds(0.5f)); if (GetComponent <PlaysAudioRemarkOnRadio>()) { var maxIndex = GetComponent <PlaysAudioRemarkOnRadio>().remarks.Count; GetComponent <PlaysAudioRemarkOnRadio>().Play(Random.Range(2, maxIndex)); } audioPlayer.PlayOneShot(1); foreach (GameObject subscriber in subscribers) { subscriber.SendMessage("OnRejectFromCauldron", item, SendMessageOptions.DontRequireReceiver); } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); LeanTween.move(item.gameObject, pointForRejected.position, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); if (itemRigidbody != null) { itemRigidbody.useGravity = true; itemRigidbody.isKinematic = false; } item.isAbleToInteract = true; yield return(new WaitForSeconds(1.5f)); itemRigidbody.isKinematic = true; }
void SetVisibility(bool show) { isVisible = show; var targetPosition = onShowPosition; var targetScaleY = 1f; var targetEase = LeanTweenType.easeOutBounce; if (!show) { reticle.SetBodyScale(0f); targetPosition = onHidePosition; targetScaleY = 0f; targetEase = LeanTweenType.easeInSine; if (King.placeManager.currentPlace != null && King.placeManager.currentPlace.placeState == Place.PlaceState.Playable) { King.visitor.sight.enabled = true; } buttonInFocus = null; soundPlayer.PlayOneShot(1); } else { body.SetActive(true); soundPlayer.PlayOneShot(0); } LeanTween.cancel(body); LeanTween.move(body, targetPosition, 1f).setOnComplete(delegate() { body.SetActive(show); }).setEase(targetEase); LeanTween.scaleY(body, targetScaleY, 1f).setEase(targetEase); }
public void Take(ObtainableItem item) { //Debug.Log("Visitor takes "+item); itemInHand = item; item.Obtains(); sight.ResetTarget(); sight.reticle.SetBody(1); if (soundPlayer != null) { soundPlayer.PlayOneShot(0); } }
IEnumerator ShowCo() { bookIsShown = true; LeanTween.cancel(gameObject); LeanTween.move(gameObject, bookReadPoint.position, showAnimationDuration).setEase(LeanTweenType.easeInOutCubic); LeanTween.rotate(gameObject, bookReadPoint.rotation.eulerAngles, showAnimationDuration).setEase(LeanTweenType.easeInOutCubic); if (audioPlayer != null) { audioPlayer.PlayOneShot(0); } yield return(new WaitForSeconds(showAnimationDuration)); if (!bookIsShown) { yield break; } foreach (RecipeIcon icon in recipeIcons) { icon.GetComponent <InteractiveObject>().isAbleToInteract = true; } }
IEnumerator MakePopcornCo(InteractiveThing thing) { LeanTween.move(gameObject, thing.transform.position, 2f).setEase(LeanTweenType.easeOutSine); yield return(new WaitForSeconds(3f)); var currentScale = initScale; for (int i = 0; i < popcorn.Length; i++) { var pop = popcorn[i]; pop.gameObject.SetActive(true); var prevScale = currentScale; currentScale = currentScale * 0.9f; soundPlayer.PlayOneShot(i); LeanTween.scale(cornBody, currentScale, 0.1f).setEase(LeanTweenType.easeInCirc); yield return(new WaitForSeconds(0.1f)); var randomForce = Random.Range(0.1f, 0.2f); pop.GetComponent <Rigidbody>().useGravity = true; pop.GetComponent <Rigidbody>().isKinematic = false; pop.GetComponent <Rigidbody>().AddForce(Vector3.back * randomForce, ForceMode.Impulse); LeanTween.scale(cornBody, prevScale, 0.1f).setEase(LeanTweenType.easeInOutCirc); yield return(new WaitForSeconds(0.25f)); } /* * popcorn.gameObject.SetActive(true); * * popcorn.GetComponent<Rigidbody>().useGravity = true; * popcorn.GetComponent<Rigidbody>().isKinematic = false; * popcorn.GetComponent<Rigidbody>().AddForce(Vector3.back * 0.25f, ForceMode.Impulse); */ LeanTween.scale(cornBody, Vector3.zero, 0.2f).setEase(LeanTweenType.easeInCirc); yield return(new WaitForSeconds(0.2f)); gameObject.SetActive(false); }
IEnumerator StartIntroCo() { float totalSec = 60f; float sub = 0; narrativeIsPlaying = true; sub += 3f; yield return(new WaitForSeconds(3f)); FadeMusicTo(0.1f, 0.5f); yield return(new WaitForSeconds(0.5f)); voicePlayer.PlayOneShot(0); yield return(new WaitForSeconds(totalSec - sub)); FadeMusicTo(1f, 0.5f); narrativeIsPlaying = false; }
void Meow() { var soundIndex = Random.Range(0, soundPlayer.sounds.Length); soundPlayer.PlayOneShot(soundIndex); }