public void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { luanda = collision.GetComponent <LuandaScript>(); luanda.TakeDamage(20); gameObject.SetActive(false); //XpLODE(); GameObject spawnbullet = Instantiate(dust, transform.position, Quaternion.identity) as GameObject; } if (collision.gameObject.tag == "Rocks") { //enemy = collision.GetComponent<EnemyScript>(); //enemy.TakeDamage(20); gameObject.SetActive(false); //XpLODE(); GameObject spawnbullet = Instantiate(dust, transform.position, Quaternion.identity) as GameObject; } }
// Start is called before the first frame update void Start() { luanda = FindObjectOfType <LuandaScript>(); }