예제 #1
0
    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);
    }
예제 #2
0
 public void OnButtonDoDamage()
 {
     enemyScript.OnButtonDoDamage();
 }