private void OnCollisionEnter(Collision collision) { mbEnemy enemy = collision.gameObject.GetComponent <mbEnemy>(); Debug.Log(string.Format("Collision detected between {0} and {1}", gameObject.name, collision.collider.name)); if (enemy != null) { enemy.OnButtonDoDamage(); } Instantiate(effectPrefab, effectSpawnLocation.position, effectSpawnLocation.rotation); Destroy(gameObject); }
public void OnButtonDoDamage() { enemyScript.OnButtonDoDamage(); }