示例#1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        LaserController playerLaser = collider.gameObject.GetComponent <LaserController>();

        playerLaser.enemyHit();
        health -= playerLaser.GetDamage();
        if (health <= 0)
        {
            Destroy(gameObject);
            scoreKeeper.Score(scoreVal);
            AudioSource.PlayClipAtPoint(enemyDeathSound, transform.position);
        }
    }