31 lines
733 B
C#
31 lines
733 B
C#
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>();
|
|
enemy.EnemyHpDown(harm);
|
|
Destroy(this.gameObject);
|
|
}
|
|
if (collision.gameObject.CompareTag("ore"))
|
|
{
|
|
Ore ore = collision.gameObject.GetComponent<Ore>();
|
|
ore.OreHpDown(harm);
|
|
Destroy(this.gameObject);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|