void OnMouseDown() { if (canRemove) { Destroy(gameObject); _checkCoins.AddCoins(); } }
private void EndLVL() { _lvlComplete = true; int CoinsNum = Random.Range(40, 71); _saveController.SaveCurrentLvl(); _uiController.ActivateWinPanel(CoinsNum); _coinsController.AddCoins(CoinsNum); }
IEnumerator SleepAndMoveCam(float sec, int combo) { shotPerformed = false; currentSpot.GetComponent <EllipsoidParticleEmitter>().Emit(1); if (combo > 1) { GameObject comboText = comboHolder.transform.GetChild(0).gameObject; comboHolder.transform.position = currentSpot.transform.position; comboText.GetComponent <Text>().text = "+" + combo.ToString(); float scale = (70f + ((float)combo / 2f) * 10f); if (scale > 120f) { scale = 120f; } comboText.GetComponent <RectTransform>().sizeDelta = Vector3.one * scale; comboText.GetComponent <Animation>().Play(); int colorID = Random.Range(0, bgController.bgTints.Count); if (colorID == bgController.currentColorIndex) { colorID = (colorID + 1) % bgController.bgTints.Count; } bgController.destColor = bgController.bgTints[colorID]; bgController.currentColorIndex = colorID; coinsController.AddCoins(1, 1); } yield return(new WaitForSeconds(sec)); camController.cameraDest = new Vector3(this.transform.position.x, this.transform.position.y, -10); camController.cameraReady = false; Animation anim = currentSpot.GetComponent <Animation>(); anim.clip = anim.GetClip("FadeOut"); anim.Play(); if (combo > 1) { int rnd = Random.Range(1, spotSprites.Length); if (spotSprites[rnd] == spotPrefab.GetComponent <SpriteRenderer>().sprite) { rnd = (rnd + 1) % spotSprites.Length; } spotPrefab.GetComponent <SpriteRenderer>().sprite = spotSprites[rnd]; } currentSpot = (GameObject)Instantiate(spotPrefab, new Vector2(this.transform.position.x + (float)Random.Range(-120, 120) / 100f, this.transform.position.y + 5.925f - ((float)Random.Range(0, 450) / 100)), Quaternion.identity); }