private IEnumerator DecisionAnimationSequence(CardDecision decision) { DisableDrag(); DisableFlip(); AudioControl.PlayAudioFromSource(onDecisionAudioClip); float startTime = Time.time, overTime = 0.25f; Vector3 initScale = new Vector3(1.0f, 1.0f, 1.0f); Vector3 finalScale = new Vector3(2.0f, 2.0f, 2.0f); while (Time.time < startTime + overTime) { canvasGroup.alpha = Mathf.Lerp(1.0f, 0.0f, (Time.time - startTime) / overTime); transform.localScale = Vector3.Lerp(initScale, finalScale, (Time.time - startTime) / overTime); yield return(null); } GameManager.instance.player.ApplyDecisionEffects(decision); ReferencesManager.instance.leftDropZone.transform.Find("Decision").GetComponent <CanvasGroup>().alpha = 0; ReferencesManager.instance.rightDropZone.transform.Find("Decision").GetComponent <CanvasGroup>().alpha = 0; ReferencesManager.instance.deck.Discard(); if (ReferencesManager.instance.deck.cards.Count >= 0) { GameManager.instance.ValidateAttributes(); } yield return(new WaitForSeconds(0.1f)); ReferencesManager.instance.deck.Draw(); EnableDrag(); EnableFlip(); }
public virtual void Action() { AudioControl.PlayAudioFromSource(audioClip); if (loop != null) { AudioControl.PlayAudioFromSource(loop, true); } }
// Use this for initialization void Start() { vibrationToggle.Set(GameManager.instance.settings.vibration, false); audioToggle.Set(GameManager.instance.settings.audio, false); if (GameManager.instance.firstTimeLoaded) { AudioControl.PlayAudioFromSource(audioClip, true); GameManager.instance.firstTimeLoaded = false; } }
void OnTriggerEnter2D(Collider2D other) { isActive = true; if (GameManager.instance.settings.vibration) { Handheld.Vibrate(); } AudioControl.PlayAudioFromSource(audioClip); StartCoroutine(this.AnimateCanvasGroupAlpha(decisionDisplay, 0.0f, 1.0f, fadeTime)); }
private IEnumerator ModalFadeIn() { float startTime = Time.time; float initValue = 0.0f, finalValue = 1.0f; while (Time.time < startTime + openCloseTime) { canvasGroup.alpha = Mathf.Lerp(initValue, finalValue, (Time.time - startTime) / openCloseTime); yield return(null); } AudioControl.PlayAudioFromSource(audioClip); canvasGroup.alpha = finalValue; }