private static void OnCircleDeactivatedHandler(Circle sender, CircleDeactivatedEventArgs args) { GainedScore += args.GainedPoints; if (Stages.CurrentStage.IsLastLevel()){ temporaryUnavailable.circles.Remove (sender); } else { temporaryUnavailable.Push (sender); } if (args.GainedPoints < 1 || tapsLeft <= 1) { gameOver = true; foreach (var circle in circles) { circle.OnCircleDeactivated -= OnCircleDeactivatedHandler; circle.SetToWhiteAndDisable(); } if (tapsLeft <= 1) { IsLevelSuccesful = true; } if (args.GainedPoints <= 0) { IsLevelSuccesful = false; } if (args.TappedOutside) { DateTime time = DateTime.Now; var ac = Resources.Load("BuzzerSFX") as AudioClip; AudioSource.PlayClipAtPoint(ac, Vector3.zero, 0.7f); self.Background.MakeItRed(); self.StartCoroutine(self.GameOverAfter(1.25f)); self.Background.box.enabled = false; foreach(var it in circles) { it.CircleCol.enabled = false; } Debug.Log ("before end of level time_:::" + (DateTime.Now - time).TotalMilliseconds); } else { DateTime time = DateTime.Now; tapsLeft--; self.StartCoroutine(self.GameOverAfter(0.2f)); Debug.Log ("before end of level time_:::" + (DateTime.Now - time).TotalMilliseconds); } } else { if ( (Time.time - LastTapTime) < kDoubleTapTreshold) { // showing the bonus LastTapTime = -10; Bonus.OnDoubletapped(args.GainedPoints); } else { LastTapTime = Time.time; clickTimeVec.Add(sender.GetReactionTimeMs()); } tapsLeft--; } bool clear = circles.Where(circle => circle.IsActivated).Count() == 0; if (clear && !gameOver && Stages.CurrentStage.IsLastLevel()) { self.StartCoroutine(self.ActivateAllTheCirlesDelayed(0.2f)); } lastGained = args.GainedPoints; }
public void DeactivateCircle() { tappedAt = DateTime.Now; this.IsActivated = false; this.StopAllCoroutines(); var args = new CircleDeactivatedEventArgs(); args.GainedPoints = (int)currentState; if (args.GainedPoints >= 1) { this.ring.gameObject.SetActive(true); this.ring.circle = this; this.ring.ResetRing(); this.floatingText.gameObject.SetActive(true); this.floatingText.Score = args.GainedPoints; this.floatingText.ResetScore(BlockedDirectionID); } if (this.OnCircleDeactivated != null) { this.OnCircleDeactivated(this, args); } this.currentState = CircleState.Red; currentRenderer.material.color = Color.white; if (GameController.IsHardMode) { GetComponent<SpriteRenderer> ().enabled = false; shadow.GetComponent<SpriteRenderer>().enabled = false; transform.localPosition = new Vector3 (transform.localPosition.x, transform.localPosition.y, -1f); } }