using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { public int harm; private void Start() { Destroy(this.gameObject,1f); } private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("enemy")) { Enemy enemy = collision.gameObject.GetComponent(); enemy.EnemyHpDown(harm); Destroy(this.gameObject); } if (collision.gameObject.CompareTag("ore")) { Ore ore = collision.gameObject.GetComponent(); ore.OreHpDown(harm); Destroy(this.gameObject); } } }