public void Show() { transform.position = _startPos + Vector3.down * Screen.height; iTween.MoveTo(gameObject, _startPos, 1); iTween.ScaleTo(gameObject, Vector3.one, 1); StartCoroutine(Coroutines.FadeTo(_canvasGroup, 1, .5f)); }
private void OnSceneTransitionStarted(BuildScenes?from, BuildScenes to) { StartCoroutine(Coroutines.FadeTo(_canvasGroup, 1, transitionTime, () => { SceneManager.LoadSceneAsync((int)to).completed += operation => StartCoroutine( Coroutines.FadeTo(_canvasGroup, 0, transitionTime, () => { _gameStateService.TriggerSceneTransitionFinished(); })); })); }
private void TriggerFade(float target) { if (_canvasGroupFadeCoroutine != null) { StopCoroutine(_canvasGroupFadeCoroutine); } _canvasGroupFadeCoroutine = StartCoroutine(Coroutines.FadeTo(_canvasGroup, target, BeatInputService.HALF_NOTE_TIME)); }
private void ExecutionStarting(Song song, int streakPower) { if (streakPower > _prevStreakPower) { StartCoroutine(Coroutines.FadeTo(streakText.GetComponent <CanvasGroup>(), 1, BeatInputService.HALF_NOTE_TIME)); streakText.SetGradient(streakPowerGradients[streakPower - 1]); streakText.TriggerImpulse(); } _prevStreakPower = streakPower; }
private void OnGameFinishing() { _update = Constants.Noop; StartCoroutine(Coroutines.FadeTo( streakText.GetComponent <CanvasGroup>(), 0, BeatInputService.HALF_NOTE_TIME)); _beatInputService.MetronomeTick -= MetronomeTick; StartCoroutine(Coroutines.FadeTo( songIndicator.GetComponent <CanvasGroup>(), 0, BeatInputService.HALF_NOTE_TIME)); }
private void OnGameFinishing() { float finishTime = Time.time - startTime; TimeSpan fromMilliseconds = TimeSpan.FromSeconds(finishTime); timeText.text = fromMilliseconds.Minutes + ":" + fromMilliseconds.Seconds; StartCoroutine(AnimateSummary()); StartCoroutine(Coroutines.FadeTo(finishText.GetComponent <CanvasGroup>(), 1, BeatInputService.NOTE_TIME)); iTween.MoveFrom(finishText.gameObject, new Vector3(Screen.width * .5f, Screen.height * .5f, 0), 1); finishText.StartAnimation(); finishText.TriggerImpulse(); }
private void BeatLost() { Image hitImage = _beatHitImages[NoteQuality.Miss]; _beatHitFadeHashtable["onupdate"] = CreateFadeDelegate(hitImage); GameObject hitImageGo = hitImage.gameObject; iTween.Stop(hitImageGo); Vector2 center = new Vector2(Screen.width / 2f, Screen.height * 3f / 4f); hitImageGo.transform.eulerAngles = Vector3.back * 45f; hitImageGo.transform.position = Vector2.Lerp(center, _latestTouchPosition, .5f); iTween.MoveBy(hitImageGo, _moveDownHashtable); iTween.ValueTo(hitImageGo, _beatHitFadeHashtable); _streakPower = 0; StartCoroutine(Coroutines.FadeTo(streakText.GetComponent <CanvasGroup>(), 0, BeatInputService.HALF_NOTE_TIME)); }
private void FinishTutorial() { OnDestroy(); _gameStateService.TriggerGameFinishing(); StartCoroutine(Coroutines.FadeTo(songLearnedText.GetComponent <CanvasGroup>(), 1, .25f)); StartCoroutine(Coroutines.FadeTo(songTutorial, 0, .5f)); songLearnedText.StartAnimation(); songLearnedText.TriggerImpulse(); ServiceLocator.Get <PersistenceService>().SaveCurrentPlayer(); iTween.ScaleBy(pageToScale.gameObject, Vector3.one / 1.05f, 5); StartCoroutine(Coroutines.ExecuteAfterSeconds(1.5f, () => { _update = () => { if (Input.GetMouseButtonDown(0)) { _update = Constants.Noop; _gameStateService.CurrentLevelData = targetLevel; _gameStateService.TriggerSceneTransition(BuildScenes.Ingame); } }; })); }
private IEnumerator StartGame() { int remainingTicks = 3; while (remainingTicks > 0) { remainingTicks--; countdownText.text = "" + (remainingTicks + 1); iTween.PunchScale(countdownText.gameObject, Vector3.one * 2f, BeatInputService.HALF_NOTE_TIME); yield return(new WaitForSeconds(BeatInputService.NOTE_TIME)); } countdownText.text = "Drum!"; iTween.PunchScale(countdownText.gameObject, Vector3.one * 2f, BeatInputService.HALF_NOTE_TIME); yield return(new WaitForSeconds(BeatInputService.HALF_NOTE_TIME)); _gameStateService.TriggerGameStarted(); startTime = Time.time; yield return(new WaitForSeconds(BeatInputService.NOTE_TIME)); StartCoroutine(Coroutines.FadeTo(countdownText.GetComponent <CanvasGroup>(), 0, BeatInputService.NOTE_TIME)); }
private IEnumerator AnimateSummary() { yield return(new WaitForSeconds(.5f)); iTween.MoveFrom(summaryCanvas.gameObject, new Vector3(Screen.width * .5f, Screen.height * .5f, 0), 1); StartCoroutine(Coroutines.FadeTo(summaryCanvas.GetComponent <CanvasGroup>(), 1, BeatInputService.NOTE_TIME)); yield return(new WaitForSeconds(1f)); Rect summaryPanelRect = collectedItemsPanel.rect; float columnWidth = summaryPanelRect.width / NUM_SUMMARY_COLUMNS; float rowHeight = summaryPanelRect.height / NUM_SUMMARY_ROWS; Dictionary <ItemData, int> dict = _level.CollectedItems.Aggregate(new Dictionary <ItemData, int>(), (curDict, item) => { int amount; curDict.TryGetValue(item, out amount); amount++; curDict[item] = amount; return(curDict); }); int count = 0; foreach (KeyValuePair <ItemData, int> keyValuePair in dict) { int row = count / NUM_SUMMARY_COLUMNS; int column = count % NUM_SUMMARY_COLUMNS; RectTransform collectedItem = Instantiate(collectedItemPrefab, collectedItemsPanel); collectedItem.anchoredPosition = new Vector2(column * columnWidth, (NUM_SUMMARY_ROWS - 1 - row) * rowHeight); collectedItem.GetComponentInChildren <Image>().sprite = keyValuePair.Key.sprite; collectedItem.GetComponentInChildren <Text>().text = keyValuePair.Value + ""; CanvasGroup canvasGroup = collectedItem.GetComponent <CanvasGroup>(); canvasGroup.alpha = 0; StartCoroutine(Coroutines.FadeTo(canvasGroup, 1, .25f)); iTween.ScaleFrom(collectedItem.gameObject, Vector3.one * 1.5f, .5f); yield return(new WaitForSeconds(.5f)); count++; } }
private IEnumerator FadeOutPage() { yield return(StartCoroutine(Coroutines.FadeTo(_canvasGroup, 0, 1))); FadeOutComplete?.Invoke(); }
private IEnumerator FadeInPanel() { yield return(StartCoroutine(Coroutines.FadeTo(_canvasGroup, 1, 1))); FadeInComplete?.Invoke(); }
private void Hide() { iTween.MoveTo(gameObject, _startPos + Vector3.down * Screen.height, 1); iTween.ScaleTo(gameObject, Vector3.one * .5f, 1); StartCoroutine(Coroutines.FadeTo(_canvasGroup, 0, .5f)); }