金铉Unity插件库 Unity版本2018.4.32f 目前包含本地化存储功能(根据类名存储读写),TCP客户端监听类型功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
681 B

using UnityEngine;
public class BulletScript : MonoBehaviour {
// collision check. If the projectile collides with a wall or with its own tank, then it is simply destroyed.
// If the projectile collides with an enemy tank, then it is destroyed and calls the method of reducing HP in the GameScene script.
private void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.name == "LeftBorder" || collision.gameObject.name == "RightBorder" || collision.gameObject.name == "PlayerTank") {
Destroy(gameObject);
}
else {
GameScene.instance.HitByEnemy();
Destroy(gameObject);
}
}
}