void OnTriggerEnter2D(Collider2D col) { GameObject explosion; switch (col.tag) { case "Finish": isMove = false; Destroy(center.gameObject); Destroy(this.gameObject); break; case "Missile": isMove = false; explosion = Instantiate(gameManager.GetComponent <GlobalVar> ().prefabExplosion [0]); explosion.transform.position = transform.FindChild("Tip").transform.position; explosion.transform.rotation = transform.FindChild("Tip").transform.rotation; Destroy(explosion.gameObject, 1f); Destroy(center.gameObject); Destroy(this.gameObject); break; case "Player": isMove = false; explosion = Instantiate(gameManager.GetComponent <GlobalVar> ().prefabExplosion [0]); explosion.transform.position = transform.FindChild("Tip").transform.position; explosion.transform.rotation = transform.FindChild("Tip").transform.rotation; Destroy(explosion.gameObject, 1f); Destroy(center.gameObject); Destroy(this.gameObject); break; case "Sattelite": isMove = false; explosion = Instantiate(gameManager.GetComponent <GlobalVar> ().prefabExplosion [0]); explosion.transform.position = transform.FindChild("Tip").transform.position; explosion.transform.rotation = transform.FindChild("Tip").transform.rotation; Destroy(explosion.gameObject, 1f); Destroy(center.gameObject); Destroy(this.gameObject); break; } }
void OnTriggerEnter2D(Collider2D col) { GameObject explosion; explosion = Instantiate(gameManager.GetComponent <GlobalVar> ().prefabExplosion [0]); explosion.transform.position = transform.position; explosion.transform.rotation = transform.rotation; explosion.transform.localScale *= 2; Destroy(explosion.gameObject, 1f); cannonLife--; }
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Missile") { GameObject explosion; explosion = Instantiate(gameManager.GetComponent <GlobalVar> ().prefabExplosion [0]); explosion.transform.position = transform.position; explosion.transform.rotation = transform.rotation; explosion.transform.localScale *= 2; Destroy(explosion.gameObject, 1f); audioSFX.clip = gameManager.GetComponent <GlobalVar> ().sfxExplosion [3]; audioSFX.Play(); if (isAI) { gameManager.TakePoint(); } else { gameManager.TakeDamage(); } } }