private void BlockHitEvent(Collider coll) { if (coll.tag == "Block") { int rnd = Random.Range(0, 3); if (rnd != 0) { GameMgr.CreateTarget(coll.gameObject.transform); } Destroy(coll.gameObject); //coll.gameObject.SetActive(false); } }
//public GameObject targetPrefab = null; //아이템 프리팹 private void OnTriggerEnter(Collider hitCollider) { if (hitCollider.tag == "Bullet") { gameObject.SetActive(false); int rnd = Random.Range(0, 3); if (rnd != 0) { GameMgr.CreateTarget(transform); } } //오브젝트 풀 방식으로 변경함에 따라 주석처리. //Destroy(gameObject); }