private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D c)
 {
     if (c.gameObject.tag == "Player")
     {
         Debug.Log("Entered Gate");
         gameObject.SetActive(false);
         GameManager.Points(1, points);
         ExplosionSpawner.SpawnExplosion(transform.position);
     }
 }
Exemplo n.º 3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
 // Use this for initialization
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 6
0
 void SpawnExplosion()
 {
     ExplosionSpawner.SpawnExplosion(transform.position);
 }