private void Awake() { if (instance == null) { instance = this; } }
void OnTriggerEnter2D(Collider2D c) { if (c.gameObject.tag == "Player") { Debug.Log("Entered Gate"); gameObject.SetActive(false); GameManager.Points(1, points); ExplosionSpawner.SpawnExplosion(transform.position); } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Destroy() { //add to score GameObject score = GameObject.Find("Score"); score.GetComponent <Score>().AddPoints(points); //create explosion Camera.main.GetComponent <CamShake> ().StartHeavyShake(); Vector3 explosionSpawnPos = transform.position; explosionSpawnPos.y += hSpeed * Time.deltaTime; explosionSpawnPos.x += vSpeed * Time.deltaTime; ExplosionSpawner explosionSpawner = GetComponent <ExplosionSpawner> (); if (explosionSpawner != null) { explosionSpawner.spawn(explosionSpawnPos); } Destroy(gameObject); }
// Use this for initialization void Awake() { instance = this; }
void SpawnExplosion() { ExplosionSpawner.SpawnExplosion(transform.position); }