using System.Collections; using System.Collections.Generic; using UnityEngine; public class Balloon : MonoBehaviour { public int scoreToGive = 1; public int clicksToPop = 5; public float scaleIncreasePerClick = 0.1f; public ScoreManager scoreManager; private void OnMouseDown() { clicksToPop -= 1; transform.localScale += Vector3.one * scaleIncreasePerClick; if(clicksToPop ==0) { scoreManager.IncreaseScore(scoreToGive); Destroy(gameObject); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter