Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Brick : MonoBehaviour {
- public int maxHits;
- public int blockValue ;
- private int hitCount ;
- private LevelManager levelManager ;
- void Start () {
- hitCount = 0 ;
- levelManager = GameObject.FindObjectOfType<LevelManager>() ;
- }
- // Update is called once per frame
- void Update () {
- }
- void OnCollisionEnter2D (Collision2D collision) {
- hitCount++ ;
- if (hitCount >= maxHits) {
- Destroy(gameObject) ;
- }
- //print ("Brick Hit") ;
- //SimulateWin() ;
- }
- // TODO Remove this method once we can actually win.
- void SimulateWin() {
- levelManager.LoadNextLevel();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement