void OnCollisionEnter(Collision col) { if (col.gameObject.CompareTag("Enemy")) { EnemyController enemyController = col.gameObject.GetComponent <EnemyController>(); if (enemyController) { enemyController.InflictDamage(damage); } PlayExplosionEffect(); } if (col.gameObject.CompareTag("Flagship")) { FlagshipController flagshipController = col.gameObject.GetComponent <FlagshipController>(); if (flagshipController) { flagshipController.InflictDamage(damage); } PlayExplosionEffect(); } if (col.gameObject.CompareTag("Shield")) { ObjectPooler.Instance.ReturnToPool("Bullet", this.gameObject); SEController SECon = col.gameObject.GetComponent <SEController>(); if (SECon) { SECon.DestroyObstacle(); } } if (col.gameObject.CompareTag("Obstacle")) { PlayExplosionEffect(); SEController SECon = col.gameObject.GetComponent <SEController>(); if (SECon) { SECon.DestroyObstacle(); } } if (col.gameObject.CompareTag("Bullet")) { PlayExplosionEffect(); } if (col.gameObject.CompareTag("Limitation")) { PlayExplosionEffect(); } }
void OnCollisionEnter(Collision col) { if (col.gameObject.CompareTag("Player")) { PlayerController playerController = col.gameObject.GetComponent <PlayerController>(); if (playerController) { playerController.InflictDamage(damage); } PlayExplosionEffect(); } if (col.gameObject.CompareTag("Shield")) { PlayExplosionEffect(); SEController SECon = col.gameObject.GetComponent <SEController>(); if (SECon) { SECon.DestroyObstacle(); } } if (col.gameObject.CompareTag("BLE")) { PlayExplosionEffect(); BLEController BLECon = col.gameObject.GetComponent <BLEController>(); if (BLECon) { BLECon.OnHit(); } } if (col.gameObject.CompareTag("Bullet")) { PlayExplosionEffect(); } if (col.gameObject.CompareTag("Obstacle")) { PlayExplosionEffect(); GameObject.Destroy(col.gameObject); } if (col.gameObject.CompareTag("Limitation")) { PlayExplosionEffect(); } }