update samples
This commit is contained in:
+4
-2
@@ -25,7 +25,8 @@ public class EntityAsteroid : MonoBehaviour
|
||||
}
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("PlayerBullet"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("player"))
|
||||
{
|
||||
BattleEventDefine.AsteroidExplosion.SendEventMessage(this.transform.position, this.transform.rotation);
|
||||
_handle.Restore();
|
||||
@@ -34,7 +35,8 @@ public class EntityAsteroid : MonoBehaviour
|
||||
}
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Boundary"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("Boundary"))
|
||||
{
|
||||
_handle.Restore();
|
||||
_handle = null;
|
||||
|
||||
+10
-7
@@ -19,25 +19,27 @@ public class EntityBullet : MonoBehaviour
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_rigidbody = this.transform.GetComponent<Rigidbody>();
|
||||
_rigidbody = this.transform.GetComponent<Rigidbody>();
|
||||
}
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Boundary"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("Boundary"))
|
||||
return;
|
||||
|
||||
if (this.gameObject.CompareTag("EnemyBullet"))
|
||||
var goName = this.gameObject.name;
|
||||
if (goName.StartsWith("enemy_bullet"))
|
||||
{
|
||||
if (other.CompareTag("Enemy") == false)
|
||||
if (name.StartsWith("enemy") == false)
|
||||
{
|
||||
_handle.Restore();
|
||||
_handle = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.gameObject.CompareTag("PlayerBullet"))
|
||||
if (goName.StartsWith("player_bullet"))
|
||||
{
|
||||
if (other.CompareTag("Player") == false)
|
||||
if (name.StartsWith("player") == false)
|
||||
{
|
||||
_handle.Restore();
|
||||
_handle = null;
|
||||
@@ -46,7 +48,8 @@ public class EntityBullet : MonoBehaviour
|
||||
}
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Boundary"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("Boundary"))
|
||||
{
|
||||
_handle.Restore();
|
||||
_handle = null;
|
||||
|
||||
+4
-2
@@ -68,7 +68,8 @@ public class EntityEnemy : MonoBehaviour
|
||||
}
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("PlayerBullet"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("player"))
|
||||
{
|
||||
BattleEventDefine.EnemyDead.SendEventMessage(this.transform.position, this.transform.rotation);
|
||||
_handle.Restore();
|
||||
@@ -77,7 +78,8 @@ public class EntityEnemy : MonoBehaviour
|
||||
}
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Boundary"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("Boundary"))
|
||||
{
|
||||
_handle.Restore();
|
||||
_handle = null;
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ public class EntityPlayer : MonoBehaviour
|
||||
}
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Enemy") || other.CompareTag("EnemyBullet") || other.CompareTag("Asteroid"))
|
||||
var name = other.gameObject.name;
|
||||
if (name.StartsWith("enemy") || name.StartsWith("asteroid"))
|
||||
{
|
||||
BattleEventDefine.PlayerDead.SendEventMessage(this.transform.position, this.transform.rotation);
|
||||
_handle.Restore();
|
||||
|
||||
Reference in New Issue
Block a user