private void DisplaySequence() { bar1Seq.gameObject.SetActive(false); bar2Seq.gameObject.SetActive(false); bar4Seq.gameObject.SetActive(false); tracker.gameObject.SetActive(true); switch (bars) { case 1: bar1Seq.gameObject.SetActive(true); hits = bar1Hits; dots = bar1Dots; break; case 2: bar2Seq.gameObject.SetActive(true); hits = bar2Hits; dots = bar2Dots; break; case 4: bar4Seq.gameObject.SetActive(true); hits = bar4Hits; dots = bar4Dots; break; } for (int i = 0; i < hits.Length; i++) { dots[i].color = transparent; if (sequence[i]) { if (i % 8 == 0) { hits[i].color = barColorOff; } else if (i % 2 == 1) { hits[i].color = eigthColorOff; } else { hits[i].color = forthColorOff; } } else { hits[i].color = transparent; } } state = Castle.PlayerState.Attempt; }
private IEnumerator HidePanel(bool delay, Color levelColor) { float t = 0; float time = 0; float duration = 0.25f; state = Castle.PlayerState.Idle; bar1Seq.gameObject.SetActive(false); bar2Seq.gameObject.SetActive(false); bar4Seq.gameObject.SetActive(false); tracker.gameObject.SetActive(false); if (delay) { yield return(new WaitForSeconds(duration * 4)); } else { yield return(null); } while (t < 1) { time += Time.deltaTime; t = Mathf.Clamp01(time / duration); Color transtionColorLevel = Color.Lerp(levelColor, transparent, t); Color transitionColorWhite = Color.Lerp(Color.white, transparent, t); Color transitionColorBlack = Color.Lerp(Color.black, transparent, t); mainPanel.color = Color.Lerp(panelColor, transparent, t); levelPanel.color = Color.Lerp(panelColor, transparent, t); levelBg.color = transitionColorWhite; levelBar.color = transtionColorLevel; thumbnail.color = transitionColorWhite; health.color = transitionColorWhite; healthText.color = transitionColorBlack; attack.color = transitionColorWhite; attackText.color = transitionColorBlack; yield return(null); } mainPanel.color = transparent; levelPanel.color = transparent; levelBg.color = transparent; levelBar.color = transparent; thumbnail.color = transparent; health.color = transparent; healthText.color = transparent; attack.color = transparent; attackText.color = transparent; }
public void Hit(Castle.HitType type, int step, float level, bool off) { state = Castle.PlayerState.Invoking; UpdateLevel(level); currentStep = step; if (msgAnimation != null) { StopCoroutine(msgAnimation); } Color dotColor = badColor; switch (type) { case Castle.HitType.Perfect: dotColor = perfectColor; msgAnimation = ShowMessage("Perfect", perfectColor, false); break; case Castle.HitType.Good: dotColor = goodColor; msgAnimation = ShowMessage("Good", goodColor, false); break; case Castle.HitType.TooLate: dotColor = regularColor; msgAnimation = ShowMessage("Too Late", regularColor, false); break; case Castle.HitType.TooSoon: dotColor = regularColor; msgAnimation = ShowMessage("Too Soon", regularColor, false); break; case Castle.HitType.Wrong: dotColor = badColor; msgAnimation = ShowMessage("Wrong", badColor, false); break; case Castle.HitType.Miss: dotColor = badColor; msgAnimation = ShowMessage("Miss", badColor, false); break; } if (!off) { dots[currentStep].color = dotColor; if (currentStep % 8 == 0) { hits[currentStep].color = barColor; } else if (currentStep % 2 == 1) { hits[currentStep].color = eigthColor; } else { hits[currentStep].color = forthColor; } StartCoroutine(msgAnimation); } }